
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The instructions for a programming assignment in which students are required to write a number guessing game using binary search. The game involves the user picking a number between 0 and 100, and the program making educated guesses based on user feedback. The document also includes information on how to compile and submit the program.
Typology: Exams
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Wednesday, February 16, 2011 In this assignment, you will need to write a program that guesses a number that the user picks. First, your program
telling your program that your guess is too small, too big, or exactly right. You will use the binary search method to guess a number, meaning that if you know the number is between a and b , you will guess ( a + b )/2. Your guesses must be integer, so if a + b is odd, please round down. You must use all the information the user provides
Sample run of your program when user guessed number 73 must look like this: Come up with a number between 0 and 100. I guess 50. > I guess 75. < I guess 62. > I guess 68. > I guess 71. > I guess 73. =
input. Also note that we have specified the problem so that there is only one correct guess sequence for any given user number. Be sure your program follows that sequence. Finally, note that your program may repeatedly guess the same value, but ONLY WHEN the user has lied about the actual value, or picked a value outside of the range.
Make sure your program compiles and works before your turn it in. We will not grade a program that does not compile and you will lose points if the program compiles with warnings. You obviously will not receive any points if your program does not do what it is supposed to do. Both functionality and coding style will be graded, with most points given for functionality and some points given for style. No style grading will be done if the program does not compile. Make sure that your output EXACTLY matches the specified structure and example, including spacing and punctuation. When you are finished, ensure the program compiles and call the proctor.