HI! Im trying to make a C++ console app. where you give the computer a number and it tries to guess it by process of elimination.
You put in a number for it to guess,
then it sees if it is bigger or smaller than 5000 and goes from there....
Code:
while (Guess != SecretNumber)
{
Sleep(32); //slow it down
if(Guess > SecretNumber)
{
cout << "Ok, so it's bigger than "<< Guess <<"\n\n";
Guess = Guess /2;
cout << "Um... Is it... " <<Guess<<"??\n";
}
else if(Guess < SecretNumber)
{
cout << "Ok, so it's smaller than "<<Guess<<"\n\n";
Guess = Guess - (Guess/2);
cout << "Um... Is it... " <<Guess<<"??\n";
}
else if (SecretNumber == Guess)
{
cout << "yay\n";
}
Could please tell me where I am going wrong and maybe what I need to do [/plea]
;D
Thanks