From 2af82e0adc77a3302212f81a942c57c44e22b91c Mon Sep 17 00:00:00 2001 From: fdai7727 Date: Thu, 25 Jan 2024 21:03:45 +0100 Subject: [PATCH] =?UTF-8?q?Aufteilen=20der=20Abbruchbedingung,=20sodass=20?= =?UTF-8?q?bei=20Eingabe=20von=200=20nicht=20nochmal=20Hangman=20gezeichne?= =?UTF-8?q?t=20wird=20+=20Hinzuf=C3=BCgen=20Abschiedsnachricht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Tim/hangman.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/c/Tim/hangman.c b/src/main/c/Tim/hangman.c index 49ef297..85050d1 100644 --- a/src/main/c/Tim/hangman.c +++ b/src/main/c/Tim/hangman.c @@ -106,7 +106,10 @@ void hangman() { printf("Bitte gib einen Buchstaben ein!\n"); scanf(" %c", &userSelection); - + if(userSelection == '0') + { + break; + } if(!letterGuessed(userSelection, guessWord, length)) { countWrongGuess++; @@ -114,7 +117,7 @@ void hangman() } changeLetter(userSelection, guessWord, length, displayWord); drawHangman(countWrongGuess); - if(userSelection == '0'||wordGuessed(guessWord, displayWord)||noTrysLeft(countWrongGuess,guessWord)) + if(wordGuessed(guessWord, displayWord)||noTrysLeft(countWrongGuess,guessWord)) { break; } @@ -122,6 +125,7 @@ void hangman() } }while(userSelection != '0'); + printf("Danke fuers Spielen! Auf Wiedersehen!\n"); } void getWelcomeMessageHangman() {