Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment asks you to implement a guessing game as a C++ program. For this you need to familiarize yourself with variables, ifs (nested
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?
Step by Step Solution
★★★★★
3.49 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
CODE include include using namespace std int main char chY for cont...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started