Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Guessing Game Guessing Game Player 1: T'm thinking of a number between 1 and 100. Player 2: Is it 50? Player 1: Too high. Player
Guessing Game Guessing Game Player 1: "T'm thinking of a number between 1 and 100." Player 2: "Is it 50?" Player 1: "Too high." Player 2: "Is it 25?" Player 1: "Too high." Player 2: "Is it 1?" Player 1: "Too low." Player 2: "Is it 16?" Player 1: "Correct, it took you 4 tries to guess my number." Assignment: Write a C++ program that will: 1. ask the user to enter two integers 2. the computer will then randomly select an integer between these two numbers (inclusive) 3. the computer will then ask the user to guess the number it has selected. - if the user's guess is not correct, the computer should indicate if the guess was too high or too low - if the user's guess is correct the computer should report that the guess is correct and the number of tries it took to get the right answer. Please enter 2 integers: 22 -18 I'm thinking of a number between -18 and 22. Enter guess: 22 Too High Enter guess: 10 - Too High Enter guess: 14 - Too High Enter guess: -11 - Too Low Enter guess: 18 - Too High Enter guess: 21 - Too High Enter guess: -9 - Too Low Enter guess: -17 - Too Low Enter guess: 20 - Too High Enter guess: 6 - Too High Enter guess: -2 - Too Low Enter guess: -4 - Too Low Enter guess: -15 - Too Low Enter guess: -16 - Too Low Enter guess: -8 - Too Low Enter guess: 13 - Too High Enter guess: 16 Too High Enter guess: -14 - Too Low Enter guess: 9 - Too High Enter guess: -7 - Too Low Enter guess: -12 - Too Low Enter guess: 19 - Too High Enter guess: 17 - Too High Enter guess: 11 - Too High Enter guess: 1 - Too Low Enter guess: 2 - Too Low Enter guess: 0 Too Low Enter guess: -3 - Too Low Enter guess: -13 - Too Low Enter guess: -6 - Too Low Enter guess: 4 - Too High Enter guess: 3 Correct, it took you 32 tries to guess my number. 6 Please enter 2 integers: 1 10 I'm thinking of a number between 1 and 10. Enter guess: 1 - Too Low Enter guess: 2 - Too Low Enter guess: 3 Correct, it took you 3 tries to guess my number. Please enter 2 integers: -10 10 I'm thinking of a number between -10 and 10. Enter guess: 4 - Too High Enter guess: 3 - Too High Enter guess: -3 - Too Low Enter guess: -6 - Too Low Enter guess: 5 - Too High Enter guess: -2 - Too Low Enter guess: 1 Correct, it took you 7 tries to guess my number. Please enter 2 integers: -10 -5 I'm thinking of a number between -10 and -5. Enter guess: 4 - Too High Enter guess: 3 - Too High Enter guess: -3 - Too High Enter guess: -6 - Too High Enter guess: 5 - Too High Enter guess: -2 - Too High Enter guess: 1 - Too High Enter guess: -4 - Too High Enter guess: 8 - Too High Enter guess: -1 - Too High Enter guess: 7 - Too High Enter guess: -7 - Too High Enter guess: -9 - Too Low Enter guess: -10 - Too Low Enter guess: 0 - Too High Enter guess: 2 - Too High Enter guess: -5 - Too High Enter guess: -8 Correct, it took you 18 tries to guess my number
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