Question
Write a program that plays the game of guess the number. -- This is for C++ - Your program chooses the number to be guessed
Write a program that plays the game of "guess the number." -- This is for C++
- Your program chooses the number to be guessed by selecting an integer at random in the range 1-1000.
-The program then displays the following: I have a number between 1 and 1000. You have 10 guesses to guess my number. Please type your first guess.
- For each guess entered, the program responds with one of the following:
1. Excellent! You guessed the number in [ x ] guesses! Would you like to play again (y or n)?
2. Too low. Try again.
3. Too high. Try again.
4. Sorry, you had your 10 guesses. The number was [ x ]. Would you like to play again (y or n)?
- If the player's guess is incorrect, your program should loop until the player finally guesses the correct number or exceeds the number of guesses allowed (10).
- Your program should keep telling the player "Too low" or "Too high" to help the player "zero in" on the correct answer.
The code needs to be divided into a header, implementation, and main file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started