Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C++: For this assignment, write a program which will guess a secret number within 20 guesses or less. The user will choose a secret
Using C++:
For this assignment, write a program which will guess a secret number within 20 guesses or less. The user will choose a secret number between 0-1,000,000 and the program will make guesses at the number. If the program finds the number within 20 guesses it wins; otherwise, the user wins. For each guess, the user will let the program know whether the guess is too low, too high, or correct. For example, a simple game might look like the following: Hi, my name is Brent. Think of a number between 1-1,000,000 and I'll try to determine it in 20 guesses or less. You just tell me if my guess is too low, too High, or Correct [L|H|C]. 1. 4. Is your number 1000 [L HC]? H 2. Is your number 500 [L|HC]? L 3. Is your number 750 [LHC]? H Is your number 650 [L|HC]? L 5. Is your number 660 [ LC]? H 6. Is your number 655 [L/ HC]? C I win! I guessed your number in only 6 guesses! Thanks for playing. Goodbye. The coding of this program does require an abstracted main(), which means that subprograms will be used to implement the various functions involved. For example, a separate function will display the greeting and a different function will ask each new guess, and another function will report the results of the gameStep 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