diff --git a/src/main/c/Tim/hangman.c b/src/main/c/Tim/hangman.c index 9af39d7..43949e9 100644 --- a/src/main/c/Tim/hangman.c +++ b/src/main/c/Tim/hangman.c @@ -51,7 +51,9 @@ void hangman() { printf("Bitte gib einen Buchstaben ein!\n"); scanf(" %c", &userSelection); - printf("%c\n", userSelection); + + letterGuessed(userSelection, guessWord, length, displayWord); + printf("%s\n", displayWord); } }while(userSelection != '0'); @@ -74,10 +76,33 @@ bool wordGuessed(char x[], char y[]) { if(strcmp(x,y) == 0) { + printf("Du hast gewonnen!\n"); return true; } else { return false; } +} + + +bool letterGuessed(char x, char y[], int length, char ptr[]) +{ + int counter = 0; + for(int i = 0; i0) + { + return true; + } + else + { + return false; + } + } \ No newline at end of file diff --git a/src/main/c/Tim/hangman.h b/src/main/c/Tim/hangman.h index d3160df..9819b9a 100644 --- a/src/main/c/Tim/hangman.h +++ b/src/main/c/Tim/hangman.h @@ -5,5 +5,6 @@ void hangman(); char* getWordFromList(int); bool wordGuessed(char[],char[]); +bool letterGuessed(char, char[], int, char[]); #endif