Question: **Programming language is C++** Write a complete working program that plays a number guessing game. 1. The program should generate a randm number in the

**Programming language is C++**

Write a complete working program that plays a number guessing game.

1. The program should generate a randm number in the range of 1-100 and display a message saying that I have a number, can you guess it?

2. Next, the program should REPEATEDLY prompt the user for a guess ("Please enter a guess: ")

3. Each time the user enters a number, te program should look at the user's guess and respond appropriately with one of the following messages: "Correct, you win!", "Too High", "Too Low"

4. When the user guesses correectly , the program should display a 'goodbye' message telling the user how many guesses it took to win and then terminate.

5. The ONLY ocde in the main() function should be to playGame();

6. The playGame() method should:

a. declare ALL the variable needed to play the game and report the outcomes

b. Call another method game getRandomNumber(int& number) to set the secret number.

c. Create a game loop that: i. ends when a users guess matches te secret number ii. calls a method names getUserGuess for each new guess (x2) iii. passes the user guess and the secret number to a method called evaluateGuess that compares the user input and reutrn the corret output message

7. Print the goodbye message

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!