Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++.. Create a game call Guess That Number! The program has an unlimited number of rounds. In each round the program selects a random

Using C++..

Create a game call Guess That Number! The program has an unlimited number of rounds. In each round the program selects a random number that the user has to guess.

In Round 1 the user has to guess a number less than 5 within 5 tries. If the correct number is not guessed in 5 tries than the game is over. If the correct number is guessed than the user moves onto the next round where he/she has to guess a number less than 10 within 5 tries. In each subsequent round the range of numbers is doubled (5, 10, 20, 40, etc.).

In order to program this game you will need to use if-else statements, loops and random number generation using the cmath and ctime libraries.

Output/Input:

---------------------------------- Welcome to Guess That Number! ----------------------------------

Round 1 Guess a number less than 5: 1

Incorrect! try again (4 tries remaining)

Guess a number less than 5: 2

Incorrect! try again (3 tries remaining)

Guess a number less than 5: 0

Incorrect! try again (2 tries remaining)

Guess a number less than 5: 3

Incorrect! try again (1 tries remaining)

Guess a number less than 5: 4 Correct! The number was 4

Round 2 Guess a number less than 10: 4

Incorrect! try again (4 tries remaining)

Guess a number less than 10: 6

Incorrect! try again (3 tries remaining)

Guess a number less than 10: 1

Incorrect! try again (2 tries remaining)

Guess a number less than 10: 2

Incorrect! try again (1 tries remaining)

Guess a number less than 10: 7

Correct! The number was 7

Round 3 Guess a number less than 20: 0

Incorrect! try again (4 tries remaining)

Guess a number less than 20: 1

Incorrect! try again (3 tries remaining)

Guess a number less than 20: 2

Incorrect! try again (2 tries remaining)

Guess a number less than 20: 3 I

ncorrect! try again (1 tries remaining)

Guess a number less than 20: 4

Incorrect! Out of guesses :(

Game Over!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

What is finance?

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago