You will want to keep track of the range of numbers that


Write a game program guess which tries to guess what number you have chosen in as few guesses as possible. It can only ask you whether the number is less than some other number. The dialog on the console panel should look something like this:

Choose a number between 0 and 16.

Is it less than 8? y

Is it less than 4? n

Is it less than 6? n

Is it less than 7? n

Your number is 7.

The expected user inputs are y for "yes" and n for "no".

You will want to keep track of the range of numbers that might have been chosen based on the answers that have been given so far until there is only one number left. You can approximately divide an integer by 2 by right-shifting it by one bit.

*NOTE: the program is the one doing the guessing while the user is the one who inputs a number 0-16 for the computer to guess.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: You will want to keep track of the range of numbers that
Reference No:- TGS0661297

Expected delivery within 24 Hours