Answered step by step
Verified Expert Solution
Link Copied!

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++

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions