Browse Source

ask the player for retry

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
31b3bbfb83
  1. 12
      src/main/c/Hangman/playHangman.c

12
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);

Loading…
Cancel
Save