Browse Source

Created loop func to make the word game easier

main
fdlt3859 2 years ago
parent
commit
f3180ad56e
  1. 13
      src/main/quizproject.c
  2. 1
      src/main/quizproject.h

13
src/main/quizproject.c

@ -536,6 +536,18 @@ void play_guessingGame() {
printf("****************************************\n"); 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() { void play_guessTheWord() {
char word[] = "Fulda"; char word[] = "Fulda";
char guessed[MAX_WORD_LENGTH] = {0}; char guessed[MAX_WORD_LENGTH] = {0};
@ -549,6 +561,7 @@ void play_guessTheWord() {
int correct = 0; int correct = 0;
printf("Lives: %d\n", lives); printf("Lives: %d\n", lives);
v_guessTheWord(word, guessed);
printf("Guess a letter: "); printf("Guess a letter: ");
scanf(" %c", &guess); scanf(" %c", &guess);

1
src/main/quizproject.h

@ -27,6 +27,7 @@ void feedbackForm(void);
void displayCredits(void); void displayCredits(void);
void v_factorlie(void); void v_factorlie(void);
void v_guessingGame(void); void v_guessingGame(void);
void v_guessTheWord(char word[], char guessed[]);
#define NUM_QUESTIONS 5 #define NUM_QUESTIONS 5
#define round 3 #define round 3

Loading…
Cancel
Save