Discussion:
Computer Guess
(too old to reply)
Hui Frederick Lap Yip
2004-01-25 22:16:14 UTC
Permalink
I have one last concern about the 2nd case of the computer guess.
One of the TA stated in the last post that if the case:

Computer guesses 50, you say Too Low
Computer guesses 97, you say Too Low
Computer guesses 99, you say Too Low
Computer guesses 100, you say Too Low

This should print an error message and use exit(l).

However, for my program, if that is the case, after the computer guesses
99, and I say Too Low, the computer automatically says Your number is 100,
as in the same case when the computer guesses 50 and 52 and the says your
number is 51. Since we're 'supposed' to have the number in the bounds,
wouldn't my program be acceptable too, cause it forces the computer the
realize that 100 is the only number left?
Moayad Fahim Ali
2004-01-26 02:45:14 UTC
Permalink
Hi,

Yes, you are right. Thanks for pointing that out. In that case you
quoted the program would say "Your number is 100" after guessing 99
because 100 is the only option left (i.e. this belongs to case 2 of
computer_gues()).

However, if the computer guesses 50, 97, then 100 (not 99), and you say "
TOO LOW" on all of them, then you should print the error message (i.e.
this belongs to case 1 of computer_guess() applies)
Post by Hui Frederick Lap Yip
I have one last concern about the 2nd case of the computer guess.
Computer guesses 50, you say Too Low
Computer guesses 97, you say Too Low
Computer guesses 99, you say Too Low
Computer guesses 100, you say Too Low
This should print an error message and use exit(l).
However, for my program, if that is the case, after the computer guesses
99, and I say Too Low, the computer automatically says Your number is 100,
as in the same case when the computer guesses 50 and 52 and the says your
number is 51. Since we're 'supposed' to have the number in the bounds,
wouldn't my program be acceptable too, cause it forces the computer the
realize that 100 is the only number left?
Loading...