Browse Source

get input bugs fixed

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
d51e8e9705
  1. 2
      CMakeLists.txt
  2. 4
      cmake-build-debug/Testing/Temporary/LastTest.log
  3. 4
      src/main/c/Hangman/playHangman.c
  4. 3
      src/main/c/main.h

2
CMakeLists.txt

@ -25,6 +25,4 @@ add_executable(pmuw_projekt_notebinder
src/main/c/Hangman/playHangman.h
src/main/c/Hangman/Test/test_drawHangman.c
src/main/c/Hangman/Test/test_drawHangman.h
src/main/c/Hangman/Test/test_currentState.c
src/main/c/Hangman/Test/test_currentState.h
)

4
cmake-build-debug/Testing/Temporary/LastTest.log

@ -1,3 +1,3 @@
Start testing: Feb 02 10:46 CET
Start testing: Feb 06 11:59 CET
----------------------------------------------------------
End testing: Feb 02 10:46 CET
End testing: Feb 06 11:59 CET

4
src/main/c/Hangman/playHangman.c

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

3
src/main/c/main.h

@ -1,6 +1,7 @@
#ifndef MAIN_H
#define MAIN_H
#include "playHangman.h"
#include "playHangman.c"
int main();
#endif // MAIN_H
Loading…
Cancel
Save