#include <iostream>
#include <cstdlib>
#include <string>
usingnamespace std;
int main()
{
cout << " think of a question ";
cin.ignore();
cin.get();
cout << " Your answer is: \n";
int out;
out = rand()%20;
do
{
switch(out)
{
case 0 : cout << " It is certain \n";break;
case 1 : cout << " It is decidedly so \n";break;
case 2 : cout << " Without a doubt \n"; break;
case 3 : cout << " Yes, definitely \n";break;
case 4 : cout << " You may rely on it \n";break;
case 5 : cout << " As I see it, yes \n";break;
case 6 : cout << " Most likely \n";break;
case 7 : cout << " Outlook good \n";break;
case 8 : cout << " Yes \n";break;
case 9 : cout << " Signs point to yes \n";break;
case 10 : cout << " Reply hazy try again \n";break;
case 11 : cout << " Ask again later \n";break;
case 12 : cout << " Better not tell you now \n";break;
case 13 : cout << " Cannot predict now \n";break;
case 14 : cout << " Concentrate and ask again \n";break;
case 15 : cout << " Don't count on it \n";break;
case 16 : cout << " My reply is no \n";break;
case 17 : cout << " My sources say no \n";break;
case 18 : cout << " Outlook not so good \n";break;
case 19 : cout << " Very doubtful \n";break;
}
char again = 'N';
cout << " Do you want to ask again? ";
cin >> again;
}
while ( again == 'Y' || again == 'y');
}
Sorry for the lack of response my classes have kept me busy. When you say never seed the random number generator, do you mean that i did not seed my program or that you are not suppose to seed a random number generator?
If you want a different sequence of random numbers each time you run your program, you need to call srand() to seed the RNG.
Since you're not calling srand(), you're going to get the same random number and therefore the same answer every time you run your program. You should call srand() once at the top of main().