@ -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 < length )
@ -49,3 +52,10 @@ void hangman()
printf ( " %c \n " , userSelection ) ;
} while ( userSelection ! = ' 0 ' ) ;
}
char * getWordFromList ( int x )
{
return wordlist [ x ] ;
}