Question: else if (choice == 'c' ) { int num , tries= 0 ; num = rand() % 101 + 100 ; do { cout <
else if (choice == 'c')
{
int num, tries=0;
num = rand() % 101 + 100;
do
{
cout << "The computer's guess is " << num<< endl;
if (num < random)
{
cout << "Sorry, your guess is too low, try again! ";
num++;
}
if (num < random)
{
cout << "Sorry, your guess is too high, try again!";
num--;
}
}while (num != random);
}
}while (choice != 'q');
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
