|
@ -536,6 +536,46 @@ void play_guessingGame() { |
|
|
printf("****************************************\n"); |
|
|
printf("****************************************\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void play_guessTheWord() { |
|
|
|
|
|
char word[] = "Fulda"; |
|
|
|
|
|
char guessed[MAX_WORD_LENGTH] = {0}; |
|
|
|
|
|
int lives = MAX_LIVES; |
|
|
|
|
|
int word_length = strlen(word); |
|
|
|
|
|
char guess; |
|
|
|
|
|
guess = toupper(guess); |
|
|
|
|
|
|
|
|
|
|
|
while (lives > 0) { |
|
|
|
|
|
int i; |
|
|
|
|
|
int correct = 0; |
|
|
|
|
|
|
|
|
|
|
|
printf("Lives: %d\n", lives); |
|
|
|
|
|
printf("Guess a letter: "); |
|
|
|
|
|
scanf(" %c", &guess); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < word_length; i++) { |
|
|
|
|
|
if (word[i] == guess) { |
|
|
|
|
|
guessed[i] = guess; |
|
|
|
|
|
correct = 1; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!correct) { |
|
|
|
|
|
lives--; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(word, guessed) == 0) { |
|
|
|
|
|
printf("You win! The word was: %s\n", word); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (lives == 0) { |
|
|
|
|
|
printf("You lose! The word was: %s\n", word); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void feedbackForm(void){ |
|
|
void feedbackForm(void){ |
|
|
int rating; |
|
|
int rating; |
|
|
char feedback[1000]; |
|
|
char feedback[1000]; |
|
@ -591,13 +631,14 @@ int main() { |
|
|
|
|
|
|
|
|
int jump_to_menu = 0; |
|
|
int jump_to_menu = 0; |
|
|
|
|
|
|
|
|
while (choice != 5 || jump_to_menu) { |
|
|
|
|
|
|
|
|
while (choice != 6 || jump_to_menu) { |
|
|
printf("Welcome to the Game Menu!\n"); |
|
|
printf("Welcome to the Game Menu!\n"); |
|
|
printf("1. QuizGame\n"); |
|
|
printf("1. QuizGame\n"); |
|
|
printf("2. Fact or Lie?\n"); |
|
|
printf("2. Fact or Lie?\n"); |
|
|
printf("3. Who wants to be a millionaire\n"); |
|
|
printf("3. Who wants to be a millionaire\n"); |
|
|
printf("4. Guess the Number!\n"); |
|
|
printf("4. Guess the Number!\n"); |
|
|
printf("5. Exit\n"); |
|
|
|
|
|
|
|
|
printf("5. Guess the Word!\n"); |
|
|
|
|
|
printf("6. Exit\n"); |
|
|
printf("Enter your choice: "); |
|
|
printf("Enter your choice: "); |
|
|
scanf("%d", &choice); |
|
|
scanf("%d", &choice); |
|
|
|
|
|
|
|
@ -619,6 +660,10 @@ int main() { |
|
|
jump_to_menu = 1; |
|
|
jump_to_menu = 1; |
|
|
break; |
|
|
break; |
|
|
case 5: |
|
|
case 5: |
|
|
|
|
|
play_guessTheWord(); |
|
|
|
|
|
jump_to_menu = 1; |
|
|
|
|
|
break; |
|
|
|
|
|
case 6: |
|
|
printf("\nThank you for trying our C code!\n"); |
|
|
printf("\nThank you for trying our C code!\n"); |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|