Browse Source

added round 1 function and header (epic game)

main
fdlt3885 2 years ago
parent
commit
b5fa325a6c
  1. 33
      src/main/quizproject.c
  2. 1
      src/main/quizproject.h

33
src/main/quizproject.c

@ -1038,6 +1038,38 @@ int B_testround(void) {
return score; return score;
} }
int B_round1(void) {
int score = 0;
char answer[20];
printf("Round 1\n");
printf("Question 1: What is the value of x in the equation 2x + 1 = 7?\n");
printf("Hint: Subtract 1 from both sides and then divide both sides by 2.\n");
printf("Options: a.)1 b.)2 c.)3 d.)4 ");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "c") == 0) {
printf("Correct!\n");
score++;
} else {
printf("Incorrect. The answer is c.\n");
}
printf("Question 2: What is the value of x in the equation 3x + 2 = 8?\n");
printf("Hint: Subtract 2 from both sides and then divide both sides by 3.\n");
printf("Options: a.)1 b.)2 c.)3 d.)4 ");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "b") == 0) {
printf("Correct!\n");
score++;
} else {
printf("Incorrect. The answer is b.\n");
}
return score;
}
void b_epic_game() { void b_epic_game() {
B_displayWelcomeMessage(); B_displayWelcomeMessage();
@ -1048,6 +1080,7 @@ void b_epic_game() {
B_show_time(); B_show_time();
int total_score = 0; int total_score = 0;
total_score += B_testround(); total_score += B_testround();
total_score += B_round1();
} }

1
src/main/quizproject.h

@ -54,6 +54,7 @@ void B_userinfo(void);
void B_displayGameInstructions(void); void B_displayGameInstructions(void);
void B_show_time(void); void B_show_time(void);
int B_testround(void); int B_testround(void);
int B_round1(void);
#define NUM_QUESTIONS 5 #define NUM_QUESTIONS 5
#define round 15 #define round 15

Loading…
Cancel
Save