Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with this C++ program, please. Write a C++ program to implement the Number Guessing Game. In this game, the computer chooses a random number

Help with this C++ program, please.image text in transcribedimage text in transcribed

Write a C++ program to implement the Number Guessing Game. In this game, the computer chooses a random number between 1 and 100. The player tries to guess the number in 7 or less attempts. Each time the player enters a guess, the computer will display a HINT to either guess HIGHER or LOWER ifthey do not guess the random number. Once the player guesses the number, congratulate the player and prompt the user ifthey would like to play the game again. suggested Pseudocode (You may design the program yourself or you can use this Pseudocode. You do NOT have to use functions Initialize variables for the randomnumber, the guessed number, the number of attempts, and the repeat option dof Set attempts equal to 0 in case player wants to play game again Randomly generate a number between 1 and 100 (srand0 and rand0) Display "Guess My Number Game" While the "guessed number does not equal the random number AND all 7 attempts have not been used Prompt the user to enter a number between 1 and 100 Add one to the number of attempts if (guessed number is greater than the random number) Display a Hint to Guess LowER else if (guessed number is less than the random number) Display a Hint to Guess HIGHER else Display Congratulations, you guessed the (random number in how many attempts were use if the guessed number does not equal the random number Display Sorry, you did not guess the number Ask the player if they would like to play the game again? hwhile the player wants to play the game, go to the beginning of the loop to play again

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

More Books

Students also viewed these Databases questions

Question

Sort 3, 1, 4, 1, 5, 9, 2, 6 using mergesort.

Answered: 1 week ago

Question

1. Describe a dialectical approach to cultural transitions.

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago