subject

Modify the guessing-game program so that the user thinks of a number that the computer must guess. The computer must make no more than the minimum number of guesses, and it must prevent the user from cheating by entering misleading hints.
Use I'm out of guesses, and you cheated and Hooray, I've got it in X tries as your final output.
(Hint: Use the math. log function to compute the minimum number of guesses needed after the lower and upper bounds are entered.)

Below are two test runs of the program:

Enter the smaller number: 0
Enter the larger number: 10

0 10
Your number is 5
Enter =, : : >
3 4
Your number is 3
Enter =, : =
Hooray, I've got it in 3 tries!
Enter the smaller number: 0
Enter the larger number: 50
0 50
Your number is 25
Enter =, : : : : : >
1 1
Your number is 1
Enter =, : >
I'm out of guesses, and you cheated!

The results you should get:

number is 3Hooray, I've got it in 3 tries

number is 11Hooray, I've got it in 5 tries

I'm out of guesses, and you cheated

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:30
Sara is writing a program to input her monthly phone bills and output the month name and amount for the month with maximum amount. she has defined an array to hold the month names. complete the pseudocode program. [6] # program to output maximum month's phone bill monthname ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"] # define an array to hold the phone bills for each month
Answers: 1
question
Computers and Technology, 21.06.2019 20:30
In the context of it jobs in the information systems field. a is responsible for database design and implementation
Answers: 3
question
Computers and Technology, 22.06.2019 01:00
How can a broadcast station be received through cable and satellite systems?
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
You know the right answer?
Modify the guessing-game program so that the user thinks of a number that the computer must guess....
Questions
question
Mathematics, 05.05.2020 21:46
Questions on the website: 13722362