Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Coding HW You are to design and implement an application that plays the Hi-Lo guessing game with numbers. The program should start by picking

C++ Coding HW

You are to design and implement an application that plays the Hi-Lo guessing game with numbers. The program should start by picking a random number between 1 and 100 (inclusive). After that, it should repeatedly prompt the user to guess the number.

On each guess, report to the user whether he or she guessed correct. If not, report whether the guess was too high, too low, out of range (less than 1 or greater than 100).

The user can choose -1 during a game to quit the current game early. If they decide to do this, please display that as the result of his or her guess instead of to low/out of range.

Continue accepting guesses until the user guesses correctly or chooses to quit. Make sure you count the number of guesses and report that value when the user guesses correctly or chooses to quit the game. If the user quits a game, just print that he or she has quit after so many guesses.

At the end of each game (by quitting or a correct guess), prompt the user to determine whether he or she wants to play again. Continue playing games until the user chooses to stop. You can use -1 for this quit response. You can also use a letter like Y or N or even use a String like yes or no. Consider using two do loops to solve this problem although there are many other correct ways if you prefer another solution.

Run:

Be sure to test all possibilities in your test run:

Run at least two continuous games, in which you prove the counter of guesses is resetting.

Then run a game in which the user exits early with a -1. Make sure you still print the count of guesses; do not count the -1 as a guess.

Then run a game to completion but check for each of the out of range cases. A guess that is (< -1, == 0, and finally > 100)

Keep running games until user decides to quit the whole program.

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

Step: 3

blur-text-image

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions