Hey, im newer to programing and c++ i just want some tips on how to start this program.the program is to have the user guess a number, then have the program orig guess 50, and then have the user say higher or lower till the progam guesses the correct number. i would like to do this mathmatically. Im not asking for the entire answer. just some tips. I originally tried to go through every senaryo. for example;
guesses = 50
higher
guess = 75
higher
guess = 90
higher
guess = 95
lower
guess = 93
correct.
but this type of programming takes forever and there is alot of room for error.
If you want the program to guess the answer, you can use dichotomia:
say the max number is MAX, the min is MIN.
the computer compute GUESS = MIN + (MAX - MIN) / 2
Then if the user say higher MIN = GUESS else MAX = GUESS...
until MIN is equal to MAX
I give you the idea, try to make this an algorithm