#include using namespace std; int main() { int correctNumber = 36; int userGuess; int counter = 0; //ask user for number cout << " Enter a guess 0 to 100" << endl; cin >> userGuess; counter++; //determine if correct while(userGuess != correctNumber) { //determine if lower or higher if (userGuess > correctNumber) { cout << "Your number is too high. Guess again" << endl; } else { cout << "Your number is too low. Guess again" << endl; } cin >> userGuess; counter++; } //if ok say so cout << "Congratulations! You win! The number was " << correctNumber << "You needed " << counter << "tries "; return 0; }