Random generation

I am trying to create two random numbers,have the user add the two numbers together, and then check have it check to verify the answer is correct.

The first problem that i am having trouble with is getting the number to randomly generate from 10-50. rand(10-50) is the code ive tryed and ill also set the code as rand(50%) and im having a compiling issue where it says they are not vaild codes. any cclue as of what i am doing worng.
do this: int val = rand() % 51 + 10; // % is modulo/remainder

Note that you need to call srand() once at the beginning of your program (i.e. main())

See:
http://www.cplusplus.com/reference/cstdlib/rand/
Topic archived. No new replies allowed.