From 31b3bbfb83761683e08aec16fef985886de3dc59 Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Thu, 8 Feb 2024 23:56:19 +0100 Subject: [PATCH] ask the player for retry --- src/main/c/Hangman/playHangman.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/c/Hangman/playHangman.c b/src/main/c/Hangman/playHangman.c index 4aa6739..59fa7cc 100644 --- a/src/main/c/Hangman/playHangman.c +++ b/src/main/c/Hangman/playHangman.c @@ -93,7 +93,17 @@ void playHangman() { if (mistakes == MAX_MISTAKES) { currentState(currentGuess, mistakes); printf("Oops! You have no more guesses :( \n The answer was: %s \n", wordToGuess); - break; + int retry; + printf("Do you want to retry? \n"); + printf("1. YES\n"); + printf("2. NO\n"); + scanf("%d", &retry); + + if (retry == 1){ + playHangman(); + } else { + break; + } } currentState(currentGuess, mistakes);