From d51e8e9705c37468f3726032d654a00b35e3a572 Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Tue, 6 Feb 2024 13:48:44 +0100 Subject: [PATCH] get input bugs fixed --- CMakeLists.txt | 2 -- cmake-build-debug/Testing/Temporary/LastTest.log | 4 ++-- src/main/c/Hangman/playHangman.c | 4 +--- src/main/c/main.h | 3 ++- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a83ec3e..763f8e7 100644 --- a/CMakeLists.txt +++ b/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 ) diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 36c41e2..5481496 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/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 diff --git a/src/main/c/Hangman/playHangman.c b/src/main/c/Hangman/playHangman.c index ec36659..e55ee12 100644 --- a/src/main/c/Hangman/playHangman.c +++ b/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(); diff --git a/src/main/c/main.h b/src/main/c/main.h index 71870e0..899f8f6 100644 --- a/src/main/c/main.h +++ b/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 \ No newline at end of file