Question: Write a C++ program that implements a Guess-the-Number game. First call the rand() function to get a random number between 1 and 15 (I will

Write a C++ program that implements a Guess-the-Number game. First call the rand() function to get a random number between 1 and 15 (I will post a pdf about rand() during the week). The program then enters a loop that starts by printing "Guess a number between 1 and 15:". After printing this, it reads the user response. (Use cin >> n to read the user response.) If the user enters a value less than the random number, the program prints "Too low" and continues the loop. If the user enters a number larger than the random number, the program prints "Too high" and continuesthe loop. If the user guesses the random number, the program prints "You got!", and then prints: how many times the user guessed too high, how many times the user guessed too low, and the total number of guesses. You will have to keep track of how many times the user guesses.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!