In lecture 20, at the 4:45 mark, we are challenged to write a line for updating the computer’s guess. I used this:
guess = (0.5 * (max - min)) + min;
The instructor used
guess = (max + min) /2;
The compiler likes his answer just fine, but tells me I’m trying to use type double where int was defined. In both cases, the computer is dividing by 2, so at some point the int variable is going to be asked to store a fraction. So why is the computer barking at me but not the instructor?