Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Program Language: C++

Objectives:

1. Use if statements and a switch statement

2. Use random number generatros

3. Use multiple do while loops

Instructions:

This is a lot like Lab 4 but you must add more conditions and two loops to the program.

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93094759

Have any Question?


Related Questions in Computer Engineering

Technology certainly does play a large role in our lives

Technology certainly does play a large role in our lives and this has happened in a very short period of time. It has impacted the way we activities professionally, personally, and academically. For example, online educa ...

Suppose a program has a button with the caption quit

Suppose a program has a button with the caption "Quit" Suppose also that Name property of this button is btnQuit. Write a btnQuit_Click event precede that gives the user a second chance before ending the program. The prt ...

Answer the question given belowwhat is the relationship

Answer the question given below What is the relationship between a context diagram and diagram 0, and which symbol is not used in a context diagram? The response must be typed, single spaced, must be in times new roman f ...

Question an agile-focused mind-set in project

Question: "An Agile-focused Mind-set in Project Management" • Read the following two (2) articles: "The Scrum Guide," located here and "Core Scrum," located here. Contrast the role of a Scrum Master and the role of a pro ...

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

Students will create an application that allows the user to

Students will create an application that allows the user to create entities with a dialog window that will be displayed by a ListView in a separate dialog. The main dialog will keep track of how many windows and entities ...

You are saving up to buy a toyota tundra which costs 35000

You are saving up to buy a Toyota Tundra, which costs $35000 now. You don't think the price of the Toyota will change over the next two years. You don't want to borrow to pay any of this cost. You now have $10000 toward ...

A helium filled water balloon is launched from the ground

A helium filled water balloon is launched from the ground where the pressure is 752mmHg and temperature is 21c. Under these conditions it's volume is 75L. When it has climbed to an altitude where the pressure is 89mmHg a ...

A resistor selected at random from a bin containing 1 k ohm

A resistor selected at random from a bin containing 1 K Ohm 5% tolerance resistors is measured with an ohmmeter. The ohmmeter is old fashioned pointer type that introduces measurement error and operator error (it is hard ...

If you want to answer a research question regarding whether

If you want to answer a research question regarding whether a particular group of subjects experiences any significant changes in behavior as they age but you do not have the time or money for a traditional longitudinal ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As