Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are going to implement a simple guessing game in which the computer generates a random number between 1 and 100 (inclusive) and the human

You are going to implement a simple guessing game in which the computer generates a random number between 1 and 100 (inclusive) and the human player tries to guess the secret number. On each guess the program will tell the user whether or not their guess is too high, too low, or correct. Once the user makes the correct guess, it will tell the user how many trials in order to reach the correct guess. It will also ask whether user wants to play another round. At the end, it will print out the game summary with the following statistics:

Total number of rounds played: The minimum number of trials to make the correct guess The maximum number of trials to make the correct guess The average number of guess per round 

use C++ random number generator rand class to generate the target number. See random .

Here is the sample run of the guessing game:

 Welcome to the Guessing game! The computer randomly generates an integer between 1 and 100 inclusiv Your goal is to guess that number successfully in least number of tr After each of your guess, the computer will let you know whether your guess is correct or your guess is either too low or to high. Let's play!! Please enter your guess (btween 1 and 100 , inclusively): 50 your guess 50 is too big. Please enter your guess (btween 1 and 100 , inclusively): 25 Congratulation! You get the right number!! # of guess is 2 Do you want to play another round? (Y/N) y 

...

Please enter your guess (btween 1 and 100 , inclusively): 81 Congratulation! You get the right number!! # of guess is 6 Do you want to play another round? (Y/N) n Total number of rounds played : 6 The best score is : 2 Guesses The worst score is : 9 Guesses The average score is : 5.83 Guesses per round 

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_2

Step: 3

blur-text-image_3

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

2. What type of team would you recommend?

Answered: 1 week ago