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...
-
For the network shown in figure, find vo(t), t >0. e-2lu(t) V 1 F ww 2u(t) A vo(t) 1 H 1 0
-
1. On January 1, 2012, Microsport, Inc., purchased $120,000 face value of the 9% bonds of Service Express, Inc., at 104. The bonds mature on January 1, 2017. For the year ended December 31, 2015,...
-
The Gallup Organization surveyed 1,252 debit cardholders in the United States and found that 180 had used the debit card to purchase a product or service on the Internet (Card Fax, November 12,1999)....
-
At September 30, 2016, the accounts of Spring Heights Medical Center (SHMC) include the following: Accounts Receivable...............$143,000 Allowance for Bad Debts (credit balance)....... 3,300...
-
Heidi, age 61, has contributed $20,000 in total to her Roth 401(k) account over a six-year period. When her account was worth $50,000 and Heidi was in desperate need of cash, Heidi received a $30,000...
-
As the accountant for Runson Moving Company, you are preparing the companys annual return, Form 940 and Schedule A. Use the following information to complete Form 940 and Schedule A on pages 5-40 to...
-
Would you be more willing or less willing to buy a share of Microsoft stock in each of the following situations? Explain your answer. [10] i. Your wealth falls. ii. You expect the stock to appreciate...
-
How much Group Revenue do you currently have booked for September 2024? (format $, no decimals; e.g, $5,000) How much additional Group Revenue do you need to book to hit your budget for September...
-
What strategies do businesses have in place that promote equal opportunity within the organization? Do most businesses offer career development and training to its employees? If so, why? How do...
-
How do you do the step method in cost accounting? I need help understanding the difference between the step method and reciprocal method.
-
1- How do long-term care changing the health care system in the 21st century? What ethical issues do you see playing a role in this situation? 2- Why do long-term health care and palliative care...
-
How do the processes and layouts of Harley Davidson enable it to deliver goods and services to its customer? (How do they do what they do with the resources they have?)
-
31, 2020. Leigh Corp, approved a formal plan to dispose of its Knit Products Division. On December 31, 2020. the Knit Products Division was held for sale but had not been sold. The Knit Products...
-
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...
-
How would the value chain approach to internal analysis be used? (R-56)
-
Does this seem appropriate for the situation the organization is in now?
-
Does the culture appear to be strong or weak?
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App