Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use c++ please. thanks Question 2: Implement a number guessing game. The program should randomly choose an integer between 1 and 100 (inclusive), and have

image text in transcribed
image text in transcribed
use c++ please. thanks
Question 2: Implement a number guessing game. The program should randomly choose an integer between 1 and 100 (inclusive), and have the user try to guess that number. Implementations guidelines: 1. The user can guess at most 5 times. 2. Before each guess the program announces: An updated guessing-range, taking into account previous guesses and responses. The number of guesses that the user has left. 3. If the user guessed correctly, the program should announce that, and also tell how many guesses the user used. 4. If the user guessed wrong, and there are still guesses left, the program should tell the user if the number (it chose) is bigger or smaller than the number that the user guessed. 5. If the user didn't guess the number in all of the 5 tries, the program should reveal the number it chose. 6. Follow the execution examples below for the exact format. In order to generate random numbers (of type int), you should first call the srand function (one time) to initialize a seed for the random number generator. Then, you can call the rand function repeatedly to generate random integers. Follow the syntax as demonstrated in the code below: 1. #include 2. include 3. #include 4. using namespace std; int main() { int x1, x2, x3, x4; srand(time(0)); 10. 11. 12. 13. 14. 15. 16. x1 = rand(); x2 = rand(); x3 = rand() 100; x4 - (rand() #100) + 1; 17. 18. 19.) cout

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

Students also viewed these Databases questions

Question

Why is repatriation orientation and training needed?

Answered: 1 week ago