look up the random number class that is already included in C++ you don't need to re-invent the wheel, you do however need to know how to click in the search box and type 'random'
the first 2 entries will be what you need to use. rand() and srand(), and probably both together.
#include <iostream>
#include <cstdlib>
#include <time>
usingnamespace std;
int randomNum ( int numberOutOf )
{
return ( 1 + rand() % numberOutOf );
}
int main()
{
srand(time (NULL)); // so rand() seeds the time, using seconds.
int num1, num2, num3;
num1 = randomNum(500); // random number between 1 and 500
num2 = randomNum(200); // random number between 1 and 200
num3 = randomNum(1000); // random number between 1 and 1000
cout << "Number 1 is: " << num1 << endl;
cout << "Number 2 is: " << num2 << endl;
cout << "Number 3 is: " << num3 << endl;
return 0;
}