#include<iostream>
#include<ctime>
using namespace std;
int main()
{
int number = 0,
guess = 0;
bool again = true;
char answer;
srand(time(NULL));
do{
number = rand()%3 + 1;
cout << "\n\tGuess a number from 1 to 3: ";
cin >> guess;
while(again)
{
if(number == guess)
{
cout << "\n\tGood guess! The correct number was " << number;
again = false;
}
else
{
cout << "\n\tIncorrect! "<< guess << " is not the right answer.";
cout << "\n\tTry again.";
cout << "\n\n\tGuess a number from 1 to 3: ";
cin >> guess;
}
}
cout << "\n\n\tWould ye' like to try again? (Y/N) ";
cin >> answer;
again = true;
}while(answer == 'Y' || answer == 'y');
return 0;
} Clinton Portis
Practically a Posting Shark
833 posts since Oct 2005
Reputation Points: 237
Solved Threads: 118