This is what your code is doing
( the semicolons after the if expressions mean that they do nothing)
cout << "I'm thinking of a number between 1-100\n";
cout << "Guess what it is: ";
cin >> usersGuess;
cin.ignore(1000, 10);
while(true) {
if( usersGuess == 7) { break; } // see if the guess is right
if( usersGuess > 7 ){
// do nothing
}
cout << "That's too high.\n";
cout << "Guess what it is: ";
cin >> usersGuess;
cin.ignore(1000, 10);
if( usersGuess < 7){
// do nothing
}
cout << "That's too low.\n";
cout << "Guess what it is: ";
cin.ignore(1000, 10);
}
You should use braces like this:
cout << "I'm thinking of a number between 1-100\n";
while(true) {
cout << "Guess what it is: ";
cin >> usersGuess;
if( usersGuess > 7 ){
cout << "That's too high.\n";
}else if( usersGuess < 7){
cout << "That's too low.\n";
}else{ // usersGuess == 7
break;
}
}