Question: write a c++ program to Implement a number guessing game. The program should randomly choose an integer between 1 and 100 (inclusive), and have the

write a c++ program to 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 in to 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 didnt 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; 5. 6. int main() { 7. int x1, x2, x3, x4; 8. 9. srand(time(0)); 10. 11. x1 = rand(); 12. x2 = rand(); 13. x3 = rand() % 100; 14. x4 = (rand() % 100) + 1; 15. 16. cout<

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!