wednesday_programming - ECE 190 Midterm Exam 1 Spring 2011...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 190 Midterm Exam 1 Spring 2011 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 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 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 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. >
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/08/2012 for the course ECE 190 taught by Professor Hutchinson during the Spring '08 term at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online