473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

non-unique array generation and element count

1
I am currently building a tool for a friend that runs a live action rpg that has a downtime system between games.

Basically the intended result is for her to be able to enter numbers into some form fields to get a total number of dice to be rolled.

this field would then dictate the size of the random non-unique array with numbers between 1 and 10, to be generated.

we also have a difficulty threshold in the form.

I need to not only be able to generate the array, but get a total count of all elements with a value greater than difficulty form id.

for example: total dice used: 230 , difficulty: 4, output x where x= total number of elements greater than 4.

keep in mind that tdu and dif will be changing every time.

I currently have a form field that displays total dice used (var totalDice = document.generator.txtTotalDice;) and difficulty (var totalDif = document.generator.txtTotalDifficulty;)

need the final output to go to a form field -- Total Successes (var totalSuccess = document.generator.txtTotalSuccess;)

any help would be appreciated...
Oct 8 '12 #1
1 1806
Rabbit
12,516 Expert Mod 8TB
What do you have so far? Or is all you have the assignment of those variables? If that's as far as you've gotten so far, you should probably take a class or work through a tutorial before taking on a project of this size. But if you have more code than that, it would help to see it so we can diagnose what's gone wrong.

I will say this though, if all you need is what you describe above and you don't actually need the individual results, there's no need for a dynamic array. All you really need is a counter and a loop.
Oct 8 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bart Nessux | last post by:
The below code works well, except for the database insert. I want each element of the array to be inserted into the database, but only the last element of the array is inserted... all the elements...
8
by: Sowen | last post by:
Hi, I have an object "elem", there are only simple functions inside, like setName, getName, and three constructors Now I have another class "Base", need an array of elem to initialize class...
6
by: Herrcho | last post by:
in K&R Chapter 6.3 it mentions two methods to calculate NKEYS. and points out the first one which is to terminate the list of initializers with a null pointer, then loop along keytab until the...
29
by: shmartonak | last post by:
For maximum portability what should the type of an array index be? Can any integer type be used safely? Or should I only use an unsigned type? Or what? If I'm using pointers to access array...
10
by: nospam | last post by:
Hello! I can pass a "pointer to a double" to a function that accepts double*, like this: int func(double* var) { *var=1.0; ... }
5
by: blackwellam | last post by:
Hi, Firstly apologies for asking a similar question to one I know has been covered before but I'm quite new to visual basic and dont really understand the answers or how to get the next step. Im...
8
by: latin & geek via DotNetMonster.com | last post by:
hi. i'm working with something like a stack, where i want to be able to *remove* a specific element and automatically reindex the remaining. can someone please tell me how to do this? i'm only...
3
by: Steve the Pocket | last post by:
So I'm making a heapsort program... all my sort code seems to work just fine. Only problem is, the part where I create the array to test it bombs out whenever the number of elements is over 100. ...
28
by: Trups | last post by:
HI, I want to dynamically allocate array variable of type LPWSTR. Code looks like this... main() { LPWSTR *wstr; int count = Foo (wstr); for (int i = 0; i < count; i++)
1
by: peachdot | last post by:
hi, i want to create an array element of increment value in a loop. example: a= output of my code : a=
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.