|
|
@ -23,11 +23,23 @@ void hangman() |
|
|
|
do |
|
|
|
{ |
|
|
|
char guessWord[30]; |
|
|
|
char displayWord[30]; |
|
|
|
int length; |
|
|
|
strcpy(guessWord,wordlist[rand() % 10]); |
|
|
|
length = strlen(guessWord); |
|
|
|
printf("%s %d\n",guessWord, length); |
|
|
|
|
|
|
|
for (int i = 0; i <= length; i++) |
|
|
|
{ |
|
|
|
if(i<length) |
|
|
|
{ |
|
|
|
displayWord[i] = '_'; |
|
|
|
} |
|
|
|
else if(i == length) |
|
|
|
{ |
|
|
|
displayWord[i] = '\0'; |
|
|
|
} |
|
|
|
} |
|
|
|
printf("%s\n", displayWord); |
|
|
|
|
|
|
|
printf("Bitte gib einen Buchstaben ein!\n"); |
|
|
|
scanf(" %c", &userSelection); |
|
|
|