|
|
|
|
for (int a=0;a<=length;a++) , but when you found the first one, you break out of the for loop. The same happens if the first blank is not a match.answer or wrong in the for (int a=0;a<=length;a++), you create an int match variable and increment that one in the loop if it's " _ " without breaking the loop, and then, after the for loop, you check if match is 0 and increment wrong++ or otherwise answer += match. That way, if there are more than one matches, you have them covered...length: |
|
|
|
strhold[0] and ends with strhold[strhold.length() - 1], so a < length will go to a maximum of length - 1.
| Now there is another problem, The output is like this: ===================== Word to guess: S _ IE _ _ _ Enter guess: C One match! No match! One match! No match! Enter guess: ===================== |
else if (userguess != holdword.at(a)){... completely out. |
|