Posted by: Robert Frost October 18, 2004
Login in to Rate this Post:
0
?
Here is the output for your code:
C:\C-Files\Module4-Secret>a
I will guess your secret number if the number is between 0 and 10.
Is Your guess 10? 'y' or 'n'? y
Wow my guess is rightIs Your guess 10? 'y' or 'n'? Is Your guess 9? 'y' or 'n'?
-----------------------------------------------------------------------------------------------------------
C:\C-Files\Module4-Secret>a
I will guess your secret number if the number is between 0 and 10.
Is Your guess 10? 'y' or 'n'? n
Is Your guess 9? 'y' or 'n'? Is Your guess 8? 'y' or 'n'? n
Is Your guess 7? 'y' or 'n'? Is Your guess 6? 'y' or 'n'? n
Is Your guess 5? 'y' or 'n'? Is Your guess 4? 'y' or 'n'? n
Is Your guess 3? 'y' or 'n'? Is Your guess 2? 'y' or 'n'? n
Is Your guess 1? 'y' or 'n'? you Cheated
-----------------------------------------------------------------------------------------------------------
Two problems:
a) Shouldn't the program terminate when I hit 'y' saying that the guess is right. Why its asking again??
b) Shouldn't the program ask one number at a time?? Why two numbers?
I think the program that you have given is in the right track. I haven't checked the code as yet. As I copied an ran the program to see if it worked.