diff --git a/src/main/c/Tim/hangman.c b/src/main/c/Tim/hangman.c index 0e63451..974f5b6 100644 --- a/src/main/c/Tim/hangman.c +++ b/src/main/c/Tim/hangman.c @@ -6,6 +6,8 @@ #define LISTSIZE 10 #define MAX_WORD_LENGTH 30 +char* getWordFromList(int); +int getParameters(int, char*); char wordlist[LISTSIZE][MAX_WORD_LENGTH] = { "Kartoffel", "Zigarette", "Haus", "Fenster", "Kartenleseettiketiergeraet", @@ -26,11 +28,12 @@ void hangman() do { char guessWord[MAX_WORD_LENGTH]; - char displayWord[MAX_WORD_LENGTH]; int length; - strcpy(guessWord,wordlist[rand() % LISTSIZE]); + strcpy(guessWord,getWordFromList(rand() % LISTSIZE)); length = strlen(guessWord); printf("%s %d\n",guessWord, length); + + char displayWord[MAX_WORD_LENGTH]; for (int i = 0; i <= length; i++) { if(i