Also added new conditional check for whether the user guess is invalid
This commit is contained in:
@@ -20,7 +20,7 @@ int main(int argc, char *argv[])
|
||||
std::cout << "What's your guess (max= " << parameters.max_range <<"): ";
|
||||
std::cin >> user_guess;
|
||||
|
||||
while (std::cin.fail() || user_guess < 0)
|
||||
while (std::cin.fail() || user_guess < 0 || user_guess > parameters.max_range)
|
||||
{
|
||||
std::cin.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user