Answered step by step
Verified Expert Solution
Link Copied!

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managerial economics applications strategy and tactics

Authors: James r. mcguigan, R. Charles Moyer, frederick h. deb harris

12th Edition

9781133008071, 1439079234, 1133008070, 978-1439079232

More Books

Students also viewed these Computer Engineering questions

Question

Describe the approach for process design.

Answered: 1 week ago