|
@ -24,7 +24,10 @@ char getSingleCharInput() { |
|
|
return '\0'; // Error or end of file |
|
|
return '\0'; // Error or end of file |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ignoreExtraInput(); // Ignore extra characters |
|
|
|
|
|
|
|
|
// Check if the last character is a newline, if not, consume the rest of the line |
|
|
|
|
|
if (input[strlen(input) - 1] != '\n') { |
|
|
|
|
|
ignoreExtraInput(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Check if only one character is entered |
|
|
// Check if only one character is entered |
|
|
if (strlen(input) == 2 && input[1] == '\n') { |
|
|
if (strlen(input) == 2 && input[1] == '\n') { |
|
|