random number generator

I need to write a program that asks the user how many random numbers to generate. Print the users random numbers, ten per line, separated by a space. the random numbers should be single digit integers.

You must write two functions:

int getCount()
void printRandomNumbers()

output should look like this:

1 7 4 6 2 4 2 3 6 4
9 4 2 6 7 1 8 2 5 0
Algorithm :

Input : nTotal (how many random numbers to generate)
Output : (0 - 9) - single digit integers
Variables : A integer array (Suppose it's "ArrInt")

Step 1 : Input nTotal (cin)
Step 2 : Do a "nTotal"-time loop, random all affected elements (array ArrInt)
Step 3 : int getCount() {return nTotal;}
Step 4 : Create an ofstream object, write all variables (ten per line, separated by a space)

Look at http://www.cplusplus.com/forum/general/85457/#msg458348
as an example.

Hope all goes well.
Last edited on
I have made a similar program to your description, although it's where the user can design a number sequence (i.e. keep adding 5) which can handle decimal numbers as well as integers.

I have also included a part where the user can type in how many numbers of that sequence they want to see. Maybe this could give you ideas about future development of your program.

You can download it from this link: http://www.mediafire.com/download.php?q3uyswfrnma9edi

This is a GUI program

What is your compiler? May you give me a screenshot please?
Or your input - output example?
Last edited on
@ softwaretime: you're on a programming forum. It looks suspicious when you pass around an executable, and no source code.
This is because I have made a closed source program. It's closed source because I don't want other people making other versions of it which could contain bugs. I've spent 3 months working on this and the last thing I want is other people making their own version. I can confirm this is safe and secure because it's been tested on over 50 other users, with no errors reported back.
Last edited on
Topic archived. No new replies allowed.