Random numbers

I have been working on this assigment for a while now, but I just can't find the solution to this.

Here is my assigment: Create a list of random numbers; generate them in the range of 1 to 10 (Assume there will not be more then 50 numbers). Use an array to store these random numbers then create a file and store the numbers in it.

I know that you are not mind readers but pretty much everything I have written is trash.

What you have written may not necessarily be trash. Just because it doesn't work that doesn't mean it's trash.

Check out this page for some info on random numbers: http://www.cplusplus.com/reference/cstdlib/rand/

It has a nice example in there as well.

And you can check out this page for some info on input/output with files:

http://www.cplusplus.com/doc/tutorial/files/

If you want us to help you with your code, then you have to show us some code.
1) how do you generate numbers between 1-10? *hint its rand().... something

2) what size does your array need to be? *hint you said not more than 50

3) how do you access each address in the array to input values? *hint for loop

Topic archived. No new replies allowed.