This assignment asks you to implement a guessing game as a C++ program. For this you...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This assignment asks you to implement a guessing game as a C++ program. For this you need to familiarize yourself with variables, ifs (nested and multiple ifs), random numbers, and loops. The program should do the following: • Print a welcome message • Repeat the following until the game is over indicated by user entering Q' or 'q'. o Select a random number between 1 and 20. o Ask the user to input a number between 1 and 20. o Check if the user input is equal to the generated random number. • If they are equal then the user has won. Print appropriate message. • If they are not equal then give the user a hint as to whether the user's entered number is greater or less than the random number and provide two more turns to the user giving the hint at each turn. (Total number of tries at guessing the generated random number is three (3)) Below is a screenshot of a working program: Scenario 1 A number has been randomly generated between 1-20 inclusive....Guess the number: 15 You have to go higher. You have 2 attempt (s) left A number has been randomly generated between 1-20 inclusive...Guess the number: 17 You have to go lower. You have 1 attempt(s) left A number has been randomly generated between 1-20 inclusive...Guess the number: 16 CONGRATULATIONS... You win :) Enter 'Y' to play the guessing game or 'Q' to quit This assignment asks you to implement a guessing game as a C++ program. For this you need to familiarize yourself with variables, ifs (nested and multiple ifs), random numbers, and loops. The program should do the following: • Print a welcome message • Repeat the following until the game is over indicated by user entering Q' or 'q'. o Select a random number between 1 and 20. o Ask the user to input a number between 1 and 20. o Check if the user input is equal to the generated random number. • If they are equal then the user has won. Print appropriate message. • If they are not equal then give the user a hint as to whether the user's entered number is greater or less than the random number and provide two more turns to the user giving the hint at each turn. (Total number of tries at guessing the generated random number is three (3)) Below is a screenshot of a working program: Scenario 1 A number has been randomly generated between 1-20 inclusive....Guess the number: 15 You have to go higher. You have 2 attempt (s) left A number has been randomly generated between 1-20 inclusive...Guess the number: 17 You have to go lower. You have 1 attempt(s) left A number has been randomly generated between 1-20 inclusive...Guess the number: 16 CONGRATULATIONS... You win :) Enter 'Y' to play the guessing game or 'Q' to quit
Expert Answer:
Answer rating: 100% (QA)
code include include using namespace std int main char chY fo... View the full answer
Related Book For
Managerial economics applications strategy and tactics
ISBN: 978-1439079232
12th Edition
Authors: James r. mcguigan, R. Charles Moyer, frederick h. deb harris
Posted Date:
Students also viewed these computer engineering questions
-
The Managing Director, Tom Copeland has asked you to implement a process to monitor expenditure and income. He has asked you to prepare a spreadsheet to capture and compare actual income and...
-
Your boss has asked you to implement a new rotating work schedule that requires employees to work different schedules each week. Your boss would like to know how other companies in the area have...
-
Specific Electric Co. asked you to implement a pay-for- performance incentive contract for its new CEO. Using your deeper knowledge of the principal-agent problem, try it again.
-
Question 4: What is meant by statistical versus nonstatistical and probabilistic versus nonprobabilistic sample selection?
-
Calculate the present value of the operating cash flows if the revenue of a project grows at 5 percent, while expense grows at 4 percent, given that Revenue1 = $15,000 and Expense1 = $7,000. Assume...
-
Go to the Association of Certified Fraud Examiners' website and find the 2004 Report to the Nation on Occupational Fraud and Abuse. a. How long does the average fraud scheme last? b. Applied to the...
-
The Sarbanes-Oxley Act contains many sections. Which sections are the focus of this chapter?
-
Use the narratives in Chapter 1 and above to identify the typical outputs (reports and displays) the various stakeholders might want to retrieve from your database. Now, revisit the E-R diagram you...
-
A mean average of 60 on seven exams is needed to pass a course. On her first six exams, Sheryl received grades of 51, 72, 73, 59, 69, and 75 Answer parts (a) - (d) a) What grade must she receive on...
-
A college chemistry instructor thinks the use of embedded tutors (tutors who work with students during regular class meeting times) will improve the success rate in introductory chemistry courses....
-
5 . Obermeyer Corporation issued the following statement of cash flows for 2 0 1 7 . Obermeyer Corporation Statement of Cash Flows Indirect Method For the Year Ended December 3 1 , 2 0 1 7 Cash flows...
-
Starting from rest, a 1.20 kg block slides 1.50 m down a 40.0 inclined plane. If the speed of the block at the bottom is 2.21 m/s, find the work done by friction on the block.
-
A Chevrolet Bolt electric car has a battery that can store 6 0 kWh of energy and can go 2 4 0 miles. Suppose the energy content of gasoline is 1 0 kWh per liter. How many liters of gas has the same...
-
Matt made a loan of $ 3 8 , 0 0 0 for his MBA education. For the loan, Matt has to make a $ 6 5 0 monthly payment starting in a month for 7 2 months. What interest rate is stated on the loan contract?
-
The BarterCase "Will that becash?" Ben Sawyer had started handcrafting replicas of antique furniture as a retirement hobby, but at the urging offriendshe later opened a small shop to sell his...
-
A wire, 2 . 0 0 0 m long, has a cross - sectional area of 2 . 5 0 0 mm . It is hung vertically and stretches 0 . 4 0 mm when a 1 0 . 0 kg block is hung from it . Find ( a ) the stress, ( b ) the...
-
Which of the following best describes activity-based management (ABM)? O a. To manage activities that are important to employees. O b. To be actively involved in top management activities. O c. To...
-
Imagine that your best friend knows you are taking a psychology course and wonders what psychology is all about. How would you define psychology for your friend? Write an essay on the discipline of...
-
An aircraft with 100 seats serves passengers through two types of fares: full ($550) and discount ($250). Extra passengers have $50 marginal cost. Demand for discount tickets is unlimited, while...
-
Discuss the problems of aircraft noise around an airport from an externality perspective and propose a possible solution if (a) Housing existed in the airport area before the airport was built and...
-
The Ajax Corporation has the following set of projects available to it: *Note: All projects have equal risk. Ajax can raise funds with the following marginal costs: First $250 million..............
-
What is the main difference between national group pooling and international group pooling?
-
Does perfect daily balancing of accounts cost more or less than perfect notional pooling?
-
What common practice is the principal of value dates based on?
Study smarter with the SolutionInn App