|
|
@ -9,6 +9,11 @@ char toLower(char ch) { |
|
|
|
return ch; |
|
|
|
} |
|
|
|
|
|
|
|
// Ignores all inputs after the first character |
|
|
|
void ignoreExtraInput() { |
|
|
|
int c; |
|
|
|
while ((c = getchar()) != '\n' && c != EOF); |
|
|
|
} |
|
|
|
|
|
|
|
void playHangman(char *wordToGuess) { |
|
|
|
int mistakes = 0; |
|
|
@ -26,6 +31,7 @@ void playHangman(char *wordToGuess) { |
|
|
|
char guess; |
|
|
|
printf("Enter your guess: \n"); |
|
|
|
scanf(" %c", &guess); |
|
|
|
ignoreExtraInput(); |
|
|
|
|
|
|
|
// Check if the guess is lower case and is a letter (valid) |
|
|
|
if (!isalpha(guess)) { |
|
|
|