#include <iostream>
#include <time.h>
usingnamespace std;
int main()
{
int a;
cout << "Please do my homework for me\n\n hit any key then enter to contiinue\n";
cin >> a;
a=1;
srand(time(NULL));
do {
int homework = rand() %3+1;
if (homework ==1) cout << "Do your own damn homework!\n";
elseif (homework ==2) cout << "Write some of your own code and we will advise\n";
elseif (homework ==3){ cout << "http://www.cplusplus.com/reference/clibrary/cstdlib/rand/\n";
cout << "http://www.cplusplus.com/reference/clibrary/cstdlib/srand/\n\n";}
a+=1;
} while(a<=20);
return 0;
}
Not sure what you want to do... is it that instead of finding a random number in a range, e.g. 1-100, you want to have a random number from only 2 , 4, or 6 ?
I would add them to an array, then find a random number from 0-2, and do it that way.