diff --git a/src/main/quizproject.c b/src/main/quizproject.c index e086648..d4a0659 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -536,6 +536,18 @@ void play_guessingGame() { printf("****************************************\n"); } +void v_guessTheWord(char word[], char guessed[]) { + int i; + for (i = 0; i < strlen(word); i++) { + if (guessed[i]) { + printf("%c ", word[i]); + } else { + printf("_ "); + } + } + printf("\n"); +} + void play_guessTheWord() { char word[] = "Fulda"; char guessed[MAX_WORD_LENGTH] = {0}; @@ -549,6 +561,7 @@ void play_guessTheWord() { int correct = 0; printf("Lives: %d\n", lives); + v_guessTheWord(word, guessed); printf("Guess a letter: "); scanf(" %c", &guess); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 6850d0f..2497fc2 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -27,6 +27,7 @@ void feedbackForm(void); void displayCredits(void); void v_factorlie(void); void v_guessingGame(void); +void v_guessTheWord(char word[], char guessed[]); #define NUM_QUESTIONS 5 #define round 3