From 575824a102828b2f4bf401c16d72e039250b5dac Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Wed, 31 Jan 2024 13:54:24 +0100 Subject: [PATCH] all letters guessed correctly --- src/main/c/Hangman/playHangman.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/Hangman/playHangman.c b/src/main/c/Hangman/playHangman.c index 0fe32f7..178c872 100644 --- a/src/main/c/Hangman/playHangman.c +++ b/src/main/c/Hangman/playHangman.c @@ -46,6 +46,14 @@ void playHangman(char *wordToGuess) { mistakes++; } + // Check if the player guessed all the letters + if (strcmp(currentGuess,wordToGuess) == 0){ + currentState(currentGuess, mistakes); + printf("Bravo! You guessed the word: %s \n", wordToGuess); + break; + } + + } } \ No newline at end of file