View Single Post
Old Nov 15th, 2006, 3:26 PM   #8
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 852
Rep Power: 4 The Dark is on a distinguished road
2. That is an if test inside the loop - it does not stop the loop from continuing. If you have a 7 char array (like guess) and use cin to fill it from the keyboard and the user only types four characters. The value of "guess" will be "fish\0xy" where x and y could be any character. These extra characters may match letters in the secret word.

3. You don't need to have a loop if you are always going to break out of it immediately every time, just remove the loop and the break.

4. Note that your playOneRound function doesn't always return a value (e.g. after a correct guess), so it will just be returning whatever is in memory or the return register at that point.
The Dark is offline   Reply With Quote