cout << "Type your number here.";
cin >> secretNumber;
int guess = rand();
cout << "Is it " << guess << endl;
if (guess < secretNumber)
cout << "\n\nOk I have to guess lower...";
else if (guess > secretNumber)
cout << "\n\nOK I have to guess Higher...";
cout << "\n\nYes I got it!";
}while (guess == secretNumber);
Basically, I am making a program where the computer tries to guess the number that I type in. There are no compiler errors, but when I run the program, It does not stop and only guesses the same number.
for example: Is it 34567. OK I have to guess lower... (and so on)
Basically it keeps repeating what it has already done. Is there a solution to this?
Ya... I dont understand my code fully. Im trying to do one of the exercises in my book an so i am experimenting. Are you referring to the part with the srand? Because I took that out of the loop and put it under int guess;