From 3e5242d2fcb27eedc931dfc9afde45c43038e3fe Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:42:57 +0100 Subject: [PATCH] Commit 22 - Buchstaben sollen gezeigt werden --- 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 f21347f..edcf466 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -17,6 +17,7 @@ void draw_hangman(int attempts); 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]); void protokoll(){ clear_screen(); @@ -291,4 +292,13 @@ void lade_secret_word(char* secret_word, int level, char* path){ } fclose(file); } +} + +void show_letters(char secret_word[100], char guessed_letters[100]){ + printf("Erratene Buchstaben: "); + for(int i = 0; i < strlen(secret_word); i++) { + if(strchr(guessed_letters, secret_word[i])){ + printf("%c ", secret_word[i]); + } +} } \ No newline at end of file