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 EACS11 Gem 1200nAnigment NCST1AtignSt Sktion ee 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 Exercise 1 [Organize & Manage . (a) Write a pseudocode for your program. Exercise 2 [Find & Generate] Please answer the following: Which variables do you need? Which variables do you use for input? Which types do you use for which variable. Explain why? What type of loop is best to validate the input? What is the loop condition? 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 EACS11 Gem 1200nAnigment NCST1AtignSt Sktion ee 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 Exercise 1 [Organize & Manage . (a) Write a pseudocode for your program. Exercise 2 [Find & Generate] Please answer the following: Which variables do you need? Which variables do you use for input? Which types do you use for which variable. Explain why? What type of loop is best to validate the input? What is the loop condition?
Expert Answer:
Answer rating: 100% (QA)
CODE include include using namespace std int main char chY for cont... 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
-
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...
-
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...
-
Zelmer Company manufactures tablecloths. Sales have grown rapidly over the past 2 years. As a result, the president has installed a budgetary control system for 2017. The following data were used in...
-
What are the two parts of the inflation-control target?
-
As a responsible student and citizen, you can do something in mitigating ethnocentrism in your own simple ways. Make a commitment to mitigating ethnocentrism.
-
Using an incremental internal rate of return (IRR) analysis, the decision to replace the "current best" by the "challenger"' is based on what decision rule? a. The internal rate of return of the...
-
Wonderful Not only did our salespeople do a good job in meeting the sales budget this year, but our production people did a good job in controlling costs as well, said Kim Clark, president of Martell...
-
Determine profit from the following transaction. You purchase 55 SPI200 futures contracts at 7372 and hold them to expiry when the market settles at 7322.50. In your answer you must state your...
-
In Section 1.4, the analytics study team was tasked with making a recommendation for the best level of advertising for the VRX2000 during the upcoming first quarter (Q1). They used historical data...
-
Information on the following balances appeared in the books of MALUME CC on 31 December 2017: Debtors control Inventory Cash and cash equivalents Creditors control EXTRACT FROM THE STATEMENT OF THE...
-
In Agile, what is an epic?
-
Explain multiple methods through which project managers can lead by example and/or demonstrate servant leadership.
-
The Bluestar Creative Agency is developing a new marketing campaign for a client. They have determined that the clients marketing plan must be completed before the graphic design can begin. This...
-
Put the following Agile terms in order from largest to smallest: a. Themes, features, user stories b. User stories, features, themes c. Features, user stories, themes d. User stories, themes, features
-
What is a possible sign that your communication planning was/is insufficient?
-
How could the project team BEST address issues of mobility and access during construction and operations?
-
Find the equations of the ellipses satisfying the given conditions. The center of each is at the origin. Passes through (2, 2) and (1, 4)
-
In 20082009, the price of jet and diesel fuel used by air freight companies decreased dramatically. As the CEO of FedEx, you have been presented with the following proposals to deal with the...
-
Nike and Adidas face the following coordination problem in trying to decide whether to conduct heavy or light combative advertising against the other firm. What should each firmdo? Nike Light Ads...
-
The profitability of the leading cola syrup manufacturers PepsiCo and Coca-Cola and of the bottlers in the cola business is very different. PepsiCo and Coca-Cola enjoy an 81 percent operating profit...
-
Construct a frequency and relative frequency histogram of the five-year rate of- return data discussed in Example 3. Approach To draw the frequency histogram, use the frequency distribution in Table...
-
Construct a frequency and relative frequency histogram of the five-year rate of- return data discussed in Example 3. Approach We will use StatCrunch to construct the frequency and relative frequency...
-
The data in Table 14 represent the two-year average percentage of persons living in poverty, by state, for the years 20122013. Draw a stem-and-leaf plot of the data. Approach Step 1 Treat the integer...
Study smarter with the SolutionInn App