Question: In C++ Have the computer generate a number between 1 and 100, then prompt the user to input a number between 1 and 100. Test

In C++

In C++ Have the computer generate a number between 1 and 100,

Have the computer generate a number between 1 and 100, then prompt the user to input a number between 1 and 100. Test that the user's input is within the range, if it isn't, tell them that it is invalid and allow them to continue guessing. Compare the user's number to the computer's number, if the user's number is lower than the computer's, tell them that it is too low. If the number is higher than the computer's, tell them that it is too high Repeat until the user guesses the number. Keep a record of how many tries it took and display it after the user wins. Do not count any invalid entries Example Output (user input is in italics) I'm thinking of a number. Guess a value (1-100): 10 uess again: 50 Too High. Guess again: 33 Too High. Guess again: -14 Invalid Invalid Too High. Guess again: 15 Try again: 101 Try again: 20 uess again: 17 Correct You got it in 6 tries

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!