|
@ -51,8 +51,6 @@ void playHangman(char *wordToGuess) { |
|
|
// Get a letter from the user |
|
|
// Get a letter from the user |
|
|
char guess; |
|
|
char guess; |
|
|
printf("Enter your guess: \n"); |
|
|
printf("Enter your guess: \n"); |
|
|
|
|
|
|
|
|
// Function to get a single character input and check for errors |
|
|
|
|
|
guess = getSingleCharInput(); |
|
|
guess = getSingleCharInput(); |
|
|
|
|
|
|
|
|
// Check if a valid character is entered |
|
|
// Check if a valid character is entered |
|
@ -64,7 +62,7 @@ void playHangman(char *wordToGuess) { |
|
|
// Convert uppercase letter to lowercase |
|
|
// Convert uppercase letter to lowercase |
|
|
guess = toLower(guess); |
|
|
guess = toLower(guess); |
|
|
|
|
|
|
|
|
// Check if the guess is lower case and is a letter (valid) |
|
|
|
|
|
|
|
|
// Check if the guess is a letter (valid) |
|
|
if (!isalpha(guess)) { |
|
|
if (!isalpha(guess)) { |
|
|
printf("Please enter a valid alphabet.\n"); |
|
|
printf("Please enter a valid alphabet.\n"); |
|
|
ignoreExtraInput(); |
|
|
ignoreExtraInput(); |
|
|