From 6d2206f90c366d16ae8bb37e3fe98e3d4b85e7da Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:44:46 +0100 Subject: [PATCH] Commit 24 - func letters in secret word wird eingebaut --- src/main/c/hangman.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 27be097..f395ff9 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -18,6 +18,7 @@ void add_guessed_letter(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); void lade_secret_word(char* secret_word, int level, char* path); void show_letters(char secret_word[100], char guessed_letters[100]); +int letter_in_secret_word(char guessed_letter, char secret_word[100]); void protokoll(){ clear_screen(); @@ -305,4 +306,13 @@ void show_letters(char secret_word[100], char guessed_letters[100]){ } } printf("\n"); +} + +int letter_in_secret_word(char guessed_letter, char secret_word[100]){ + for(int i = 0; i < strlen(secret_word); i++){ + if(guessed_letter == secret_word[i]){ + return 0; + } + } + return 1; } \ No newline at end of file