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?
-
Write SQL queries to answer the following questions: a. Which students are enrolled in Database and Networking? b. Which instructors cannot teach both Syst Analysis and Syst Design? c. Which courses...
-
Bill Youngdahl has been collecting data at the TU student grill. He has found that between 5:00 P.M. and 7:00 P.M., students arrive at the grill at a rate of 25 per hour (Poisson distributed) and...
-
In 2014, Air Asia Flight No. 8501 crashed in the Java Sea while flying from Indonesia to Singapore. The crash resulted in the deaths of all passengers and crew on board. The plane involved in the...
-
Part A 1. How well is Scrum working? 2. What are the issues confronting the Big Foot project? 3. Assume you are Kendra. What would you want to say at the retrospective? How would you say it? 4. What...
-
Use counting to determine the whole number that corresponds to the cardinality of these sets. (a) C = {xlx = N and (x-8)(x-3)=0} (b) D = {x|x EN, 1x 100 and x is divisible by both 6 and 7} (a) n(C) =...
-
In Figure 6.5, what rate of output (a) Maximizes total revenue? (b) Maximizes profit per unit? (c) Maximizes total profit? (Choose the higher level of output.) $18 Marginal cost 16 p = MC Profits...
-
Margaret made a $90,000 interest-free loan to her son, Adam, who used the money to retire a mortgage on his personal residence and to buy a certificate of deposit. Adams only income for the year is...
-
Ingram went to a used car lot in a large city and bought a used car. On his way home from the lot, the car that he had purchased broke down. The engine stopped running altogether. The used car lot...
-
What is the central bank of the United States and what functions does it perform?
-
Retail Workforce Could Face Permanent Decline The pandemic has caused seismic changes for the retail industry. Many stores permanently closed their doors as growing numbers of customers shifted to...
-
Describe the alternative measures of the unemployment rate.
-
Why are checks, debit cards, and credit cards not money?
-
In the 1D Arrays Unit, you created a command-line Contact Manager v1. Now upgrade the software to include a graphic user interface. Your contact manager must: Have a menu bar that provides access 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..............
-
a. Express the signal in terms of unit-step functions. b. Find the Laplace transform of the expression in (a) by using the shift on t -axis. \(g(t)= 0 if t <0 1-t if 0 1
-
a. Express the signal in terms of unit-step functions. b. Find the Laplace transform of the expression in (a) by using the shift on \(t\)-axis. \(g(t)= 0 if t <0 t if 0 1
-
Find the Laplace transform of each periodic function whose definition in one period is given. \(h(t)=\left\{\begin{array}{ccc}1 & \text { if } & 0
Study smarter with the SolutionInn App