major .. serious .. C problem plz HELP!
please someone could test this program with c and tell me what the error is in this program, the way i see it is that it excutes the if and the else at the same time. I won't be long here's the program ....
One last note i tried the getch() function of course with the conio.c but it didn't make much diffrence so try it too, it might work with you
float guess, incr;
printf("Think of a number between 1 and 99, and\n");
printf("I'll guess what it is. type 'e'' for equal , 'g' for greater and 'l' for less than\n");
incr = guess = 50;
while (incr > 1.0)
printf("\nIs your number greater than or less than %.0f?\n",guess);
incr = incr / 2;
if (ch == 'g' )
guess = guess + incr;
guess = guess - incr;
printf("\n The number is %.0f. Am I not clever? \n",guess);