Im writing this program for school...but I'm curious how I would make it pause. I will include the code::
include <fstream.h>
int main()
{
int max, min, guess;
char answer;
cout << "Enter a maxium number : ";
cin >> max;
cout << "Enter a minium number : ";
cin >> min;
cout <<endl;
cout <<"Think of a number between your maxium and minium number"<<endl;
cout <<"This program will guess it"<<endl;
cout <<endl;
cout <<"You have 5 seconds before the program will attempt to guess it" <<endl;
---I WANT IT TO PAUSE HERE BEFORE IT GOES INTO THE DO----
do
{
guess = (min + max) / 2;
cout <<" Is this number correct : " << guess <<endl;
cout <<" If it is please enter Y. " <<endl;
cin >> answer;
cout <<endl;
if ( answer == 'Y' || answer == 'y')
{
cout <<"The computer rules " <<endl;
continue;
}
cout <<" If the number was incorrect: "<<endl;
cout <<" -- Enter an H for higher. "<<endl;
cout <<" -- Or an L for lower. "<<endl;
cin >>answer;
cin.ignore (80, '\n');
if (answer == 'H' || answer == 'h')
{ min=guess; }
else
{ max=guess; }
}
while ( answer != 'Y' && answer != 'y' );
return 0;
}
THanks alot