ECE190Midterm Exam1Spring 2011Wednesday, February 16, 2011In this assignment, you will need to write a program that guesses a number that the user picks. First, your program should tell the user to pick a number between 0 and 100 by printing "Come up with a number between 0 and 100." Then, your program will guess the value, and the user will enter either >, <, or =, 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 aand b, you will guess (a+b)/2. Your guesses must be integer, so if a+bis odd, please round down. You must use all the information the user provides in each round. Continue to make guesses until the user enters =. 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. = Note that if you use scanfto take your user input, some of the characters scanned by scanf
This is the end of the preview.
access the rest of the document.