Question: ----- C++ ----- it had to look like the box below. Please and thank you so much! L2-4 Example 5-6 implements the Number Guessing Game
L2-4 Example 5-6 implements the Number Guessing Game program. If the guessed number is not correct, the program outputs a message indicating whether the guess is low or high. Modify the program as follows: suppose that the variables num and guess are declared as in Example 5-6 and diff is an int variable. Let diff equal the absolute value of (num guess). If diff is zero, then guess is correct and the program outputs a message indicating that the user guessed the correct number. Suppose diff is not zero. Then the program outputs the message as follows: a) If diff is greater than or equal to 50, the program outputs the message indicating that the guess is very high (if guess is greater than num) or very low (if guess is less than num). b) If diff is greater than or equal to 30 and less than 50 the program outputs the message indicating that the guess is high (if guess is greater than num) or low (if guess is less than num). c) If the diff is greater than or equal to 15 and less than 30, the program outputs the message indicating that the guess is moderately high (if guess is greater than num) or moderately low (if guess is less than num). d) If diff is greater than zero and less than 15, the program outputs the message indicating that the guess is somewhat high (if guess is greater than num) or somewhat low (if guess is less than num). As in programming Exercise 15, give the user no more than five tries to guess the number. (To find the absolute value of num-guess, use the expression abs(num - guess). The function abs is from the header file cstdlib.) serJohnsource repos 12-41Debug 12-4.at John Urrutia L2-4 L2-4.exe Enter an integer greater than or equal to 0 and less than 100: 45 Your guess is moderately high. Guess again! Enter an integer greater than or equal to 0 and less than 100: 15 Your guess is moderately low. Guess again! Enter an integer greater than or equal to 0 and less than 100: 37 Your guess is somewhat high. Guess again! Enter an integer greater than or equal to 0 and less than 100: 23 Your guess is somewhat low. Guess again! Enter an integer greater than or equal to 0 and less than 100: 30 winner!. You guessed the correct number. Press any key to Exit
Step by Step Solution
There are 3 Steps involved in it
To modify the Number Guessing Game as described youll adjust the logic to calculate the difference a... View full answer
Get step-by-step solutions from verified subject matter experts
