Browse Source

Refactoring: Fact or Lie questions + minor fixes

main
fdlt3859 2 years ago
parent
commit
73b97d306e
  1. 8
      src/main/quizproject.c

8
src/main/quizproject.c

@ -440,9 +440,11 @@ displayThankYouMessage();
void v_factorlie(void){ void v_factorlie(void){
char statements[][100] = { char statements[][100] = {
"Tomatoes are fruits.", // fact "Tomatoes are fruits.", // fact
"The Great Wall of China is visible from space.", // lie
"Water freezes at 0 degrees Celsius.", // fact
}; };
char answers[] = {'F'}; // L for lie, F for fact
char answers[] = {'F','L','F'}; // L for lie, F for fact
int num_statements = sizeof(statements) / sizeof(statements[0]); int num_statements = sizeof(statements) / sizeof(statements[0]);
int score = 0; int score = 0;
@ -456,9 +458,9 @@ void v_factorlie(void){
user_answer = toupper(user_answer); user_answer = toupper(user_answer);
if (user_answer == answers[i]) { if (user_answer == answers[i]) {
score++; score++;
printf("Correct!\n");
printf("Correct! You get a point.\n\n");
} else { } else {
printf("Incorrect.\n");
printf("Sorry, its incorrect. No points!\n\n");
} }
} }
printf("Your final score is %d out of %d.\n", score, num_statements); printf("Your final score is %d out of %d.\n", score, num_statements);

Loading…
Cancel
Save