Browse Source

Added Guess the Animal Mini Game

main
fdlt3885 2 years ago
parent
commit
807861120f
  1. 43
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

43
src/main/quizproject.c

@ -2155,6 +2155,40 @@ void b_play_geography(){
}
//Guess animal Game
void b_guess_animal() {
char animal[20];
char user_input[20];
printf("---Welcome to Guess The Animal---\n\n");
printf("---Think of your favorite animal---\n\n");
printf("Is it a wild animal? (yes/no)\n");
scanf("%s", user_input);
if (strcmp(user_input, "yes") == 0) {
printf("Does it live in the jungle? (yes/no)\n");
scanf("%s", user_input);
if (strcmp(user_input, "yes") == 0) {
strcpy(animal, "tiger");
} else {
strcpy(animal, "gazelle");
}
} else {
printf("Is it a domesticated animal? (yes/no)\n");
scanf("%s", user_input);
if (strcmp(user_input, "yes") == 0) {
strcpy(animal, "cat");
} else {
strcpy(animal, "goldfish");
}
}
printf("Your favorite animal is a %s!\n", animal);
printf("---Thank you for Playing Guess The Animal---\n\n");
}
void v_play_rockpapersciss(){
int player_choice, computer_choice, player_score = 0, computer_score = 0;
@ -2627,7 +2661,8 @@ int main(int argc, char *argv[]) {
printf("9. Math Quiz\n");
printf("10. Check your Horoscope!\n");
printf("11. Play Geography Quiz!\n");
printf("12. Exit\n");
printf("12. Mini-Game: Guess the animal!\n");
printf("13. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
v_progress_bar(argc,argv);
@ -2676,8 +2711,12 @@ int main(int argc, char *argv[]) {
case 11:
b_play_geography();
jump_to_menu = 1;
break;
break;
case 12:
b_guess_animal();
jump_to_menu = 1;
break;
case 13:
printf("\nThank you for trying our C code!\n");
break;
default:

3
src/main/quizproject.h

@ -101,6 +101,9 @@ int b_askQuestion(int questionNumber, char* question, char* answer);
void b_displayResults(int correctAnswers);
void b_play_geography();
//Guess animal Game Headers
void b_guess_animal();
#define NUM_QUESTIONS 5
#define NUM_ROUNDS 15

Loading…
Cancel
Save