Hi Il-min,
For lab 1, you can assume correct input. (In future labs, that may or may
not be the case. It will be stated in the handout.) "Correct input" for
lab 1 means the following:
For the hangman game:
- The user will enter a single word with no whitespace, and press enter.
- The user will the enter a series of guess. Each guess is a single
non-whitespace character followed by enter.
You have been provided with example files that show correct input. So, if
you run "./hangman < in1.txt", the result you get should exactly match
"out1.txt".
For the guessing game:
- For human_guess(), the human will always enter integers. Note that if
the human is not very smart, he/she may guess a number that is out of
range, or that he/she should "know" is too high or low from a previous
guess. That is ok - the program can still tell the user that the number is
too high or too low. (I.e., if the human enters -10023, then that is too
low.)
- For computer_guess(), the human will always enter a non-whitespace
character and press enter, but the character is not necessarily 'l', 'h',
or 'c'. (If it's not, then the comptuer should ask the question again -
see the lab handout.) It doesn't matter whether or not the human is
truthful. The way the game is designed, the computer is guaranteed
eventually to reach a state where the user enters 'c', or there is only
one possibility left.
For numerical integration:
You can assume that the value 'numP' is an accurate indication of the size
of the 'P' array.
Note that you will never be penalized for having too much error checking.
Under the above assumptions, I don't think there is any error checking
left to do, but if you find a case I haven't covered, go ahead and deal
with it. (I'm not the one marking the assignments - see the webpage for a
list of marking TAs.) We've tried to keep lab 1 fairly simple. For future
labs, we may require you to do more aggressive error checking.
Alexander
Post by Suh Il-MinHi,
I've made my programs and now i have concerns about various faulty
inputs like numbers outside of min and max in guessing or string instead
of a character in hangman.
Can i assume that there will be only correct inputs or do i have to take
care of those possible faulty inputs?
Thanks.
Il-min