Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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++
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 triesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started