### 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.

This is a GUI program
@softwaretime