Question: What to do Write a C program, that can guess any number between 1 and a maximum number by way of asking simple questions that

 What to do Write a C program, that can guess any

number between 1 and a maximum number by way of asking simple

questions that can be answered with either 'Yes' or 'No'. The form

What to do Write a C program, that can guess any number between 1 and a maximum number by way of asking simple questions that can be answered with either 'Yes' or 'No'. The form of the questions asked is generally something like this: "Is your number greater than XXX?" XXX will need to be computationally determined by your program and is part of your program's logic The idea of the algorithm underlying your program's logic is that you continuously divide the range of numbers that contains the number to be guessed into two (roughly) equally sized sub-ranges and then determine which part the number to be guessed lies in using the simple kind of question mentioned above. Once you know in which range the number is, you cut the corresponding interval in half again, ask the question, cut the proper interval in half, ask, cut... you get the idea. You should convince yourself that your algorithm terminates when there is nothing to cut any more, which occurs exactly when the final interval has a length of 1, or, in other words, when the variables containing the smallest and the biggest number of the range contain the same number, which happens to be the number to be guessed I want you implement your program honoring these conventions What to do Write a C program, that can guess any number between 1 and a maximum number by way of asking simple questions that can be answered with either 'Yes' or 'No'. The form of the questions asked is generally something like this: "Is your number greater than XXX?" XXX will need to be computationally determined by your program and is part of your program's logic The idea of the algorithm underlying your program's logic is that you continuously divide the range of numbers that contains the number to be guessed into two (roughly) equally sized sub-ranges and then determine which part the number to be guessed lies in using the simple kind of question mentioned above. Once you know in which range the number is, you cut the corresponding interval in half again, ask the question, cut the proper interval in half, ask, cut... you get the idea. You should convince yourself that your algorithm terminates when there is nothing to cut any more, which occurs exactly when the final interval has a length of 1, or, in other words, when the variables containing the smallest and the biggest number of the range contain the same number, which happens to be the number to be guessed I want you implement your program honoring these conventions

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!