Browse Source

added History Mini-Game

main
fdlt3885 2 years ago
parent
commit
9d15564150
  1. 51
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

51
src/main/quizproject.c

@ -2496,6 +2496,50 @@ void b_gamble()
}
//History Game
void b_historyevents() {
int year, score = 0;
printf("Welcome to the history quiz!\n");
printf("Enter the year of the following historical events:\n");
printf("\nEvent 1: The American Revolution\n");
printf("Year: ");
scanf("%d", &year);
if (year == 1776) {
printf("You got it right!\n");
score++;
} else {
printf("Nope, the correct year is 1776.\n");
}
printf("\nEvent 2: The fall of the Berlin Wall\n");
printf("Year: ");
scanf("%d", &year);
if (year == 1989) {
printf("You got it right!\n");
score++;
} else {
printf("Nope, the correct year is 1989.\n");
}
printf("\nEvent 3: The end of World War II\n");
printf("Year: ");
scanf("%d", &year);
if (year == 1945) {
printf("You got it right!\n");
score++;
} else {
printf("Nope, the correct year is 1945.\n");
}
printf("\nYou scored %d/3.\n", score);
printf("Thanks for playing!\n");
}
void v_play_rockpapersciss(){
int player_choice, computer_choice, player_score = 0, computer_score = 0;
srand(time(NULL));
@ -2974,7 +3018,8 @@ int main(int argc, char *argv[]) {
printf("16. Breaking Bad Quiz!\n");
printf("17. Mini-Game: Crossword Puzzle!\n");
printf("18. Gambling Game!\n");
printf("19. Exit\n");
printf("19. Mini-Game: History Quiz!\n");
printf("20. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
v_progress_bar(argc,argv);
@ -3053,6 +3098,10 @@ int main(int argc, char *argv[]) {
jump_to_menu = 1;
break;
case 19:
b_historyevents();
jump_to_menu = 1;
break;
case 20:
printf("\nThank you for trying our C code!\n");
break;
default:

3
src/main/quizproject.h

@ -122,6 +122,9 @@ void b_crossword();
//Gambling Game Headers
void b_gamble();
//History Game Headers
void b_historyevents();
#define NUM_QUESTIONS 5

Loading…
Cancel
Save