Browse Source

Refactoring: added prizes after questions

main
fdlt3885 2 years ago
parent
commit
5165881d63
  1. 105
      src/main/quizproject.c

105
src/main/quizproject.c

@ -1053,6 +1053,31 @@ int B_round1(void) {
if (strcmp(answer, "3") == 0) { if (strcmp(answer, "3") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
int i, j, k;
for (i = 0; i < 5; i++)
{
for (j = 5 - i; j > 1; j--)
{
printf(" ");
}
for (k = 0; k <= (2 * i); k++)
{
printf("*");
}
printf("\n");
}
for (i = 4; i >= 0; i--)
{
for (j = 5 - i; j > 1; j--)
{
printf(" ");
}
for (k = 0; k <= (2 * i); k++)
{
printf("*");
}
printf("\n");
}
score++; score++;
} else { } else {
printf("Incorrect. The answer is 3.\n\n"); printf("Incorrect. The answer is 3.\n\n");
@ -1066,6 +1091,13 @@ int B_round1(void) {
if (strcmp(answer, "2") == 0) { if (strcmp(answer, "2") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
int i, j;
for (i = 0; i < 5; i++) {
for (j = 0; j <= i; j++) {
printf("*");
}
printf("\n");
}
score++; score++;
} else { } else {
printf("Incorrect. The answer is 2.\n\n"); printf("Incorrect. The answer is 2.\n\n");
@ -1086,6 +1118,20 @@ int B_round2(void) {
if (strcmp(answer, "False") == 0) { if (strcmp(answer, "False") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
int i, j, k;
for (i = -4; i <= 4; i++) {
for (j = 4; j >= abs(i); j--) {
printf(" ");
}
for (k = 1; k <= abs(2 * i + 1); k++) {
if (abs(i) == 4 || k == 1 || k == abs(2 * i + 1)) {
printf("*");
} else {
printf(" ");
}
}
printf("\n");
}
score++; score++;
} else { } else {
printf("Incorrect. The answer is False.\n\n"); printf("Incorrect. The answer is False.\n\n");
@ -1099,6 +1145,16 @@ int B_round2(void) {
if (strcmp(answer, "True") == 0) { if (strcmp(answer, "True") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" /\\\n");
printf(" / \\\n");
printf(" / \\\n");
printf(" / \\\n");
printf(" /________\\\n");
printf(" | \n");
printf(" | \n");
printf(" | \n");
printf(" | \n");
printf(" | \n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is True.\n\n"); printf("Incorrect. The answer is True.\n\n");
@ -1119,6 +1175,13 @@ int B_round3(void) {
if (strcmp(answer, "8") == 0) { if (strcmp(answer, "8") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
int i, j;
for (i = 0; i < 5; i++) {
for (j = 0; j <= i; j++) {
printf("*");
}
printf("\n");
}
score++; score++;
} else { } else {
printf("Incorrect. The answer is 8.\n\n"); printf("Incorrect. The answer is 8.\n\n");
@ -1132,6 +1195,7 @@ int B_round3(void) {
if (strcmp(answer, "206") == 0) { if (strcmp(answer, "206") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" /\\_/\\\n( o.o )\n > ^ < \n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is 206.\n\n"); printf("Incorrect. The answer is 206.\n\n");
@ -1151,6 +1215,8 @@ int B_round4(void) {
if (strcmp(answer, "Paris") == 0) { if (strcmp(answer, "Paris") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is Paris.\n\n"); printf("Incorrect. The answer is Paris.\n\n");
@ -1164,6 +1230,7 @@ int B_round4(void) {
if (strcmp(answer, "a") == 0) { if (strcmp(answer, "a") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" o\n \\|/\n / \\\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is a.\n\n"); printf("Incorrect. The answer is a.\n\n");
@ -1177,15 +1244,16 @@ int B_round5(void) {
printf("Round 5\n\n"); printf("Round 5\n\n");
printf("Question 1: Who invented the World Wide Web?\n\n"); printf("Question 1: Who invented the World Wide Web?\n\n");
printf("Hint: He is a British computer scientist.\n\n"); printf("Hint: He is a British computer scientist.\n\n");
printf("Options: Bill Gates, Steve Jobs, Tim Berners-Lee, Mark Zuckerberg\n\n");
printf("Options: a.)Bill Gates, b.)Steve Jobs, c.)Tim Berners-Lee, d.)Mark Zuckerberg\n\n");
printf("Answer: "); printf("Answer: ");
scanf("%s", answer); scanf("%s", answer);
if (strcmp(answer, "Tim Berners-Lee") == 0) {
if (strcmp(answer, "c") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" /\\\n ( )\n ( )\n ( )\n \\/\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is Tim Berners-Lee.\n\n");
printf("Incorrect. The answer is c.\n\n");
} }
printf("Question 2: Who was the first person to walk on the Moon?\n\n"); printf("Question 2: Who was the first person to walk on the Moon?\n\n");
@ -1196,6 +1264,7 @@ int B_round5(void) {
if (strcmp(answer, "a") == 0) { if (strcmp(answer, "a") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" (o)\n /( )\\\n( )( )\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is a.\n\n"); printf("Incorrect. The answer is a.\n\n");
@ -1210,15 +1279,16 @@ char answer[20];
printf("Round 6\n\n"); printf("Round 6\n\n");
printf("Question 1: Who wrote the novel 'To Kill a Mockingbird'?\n\n"); printf("Question 1: Who wrote the novel 'To Kill a Mockingbird'?\n\n");
printf("Hint: She is known as an American novelist.\n\n"); printf("Hint: She is known as an American novelist.\n\n");
printf("Options: Jane Austen, Agatha Christie, Harper Lee, Mary Shelley\n\n");
printf("Options: a.)Jane Austen, b.)Agatha Christie, c.)Harper Lee, d.)Mary Shelley\n\n");
printf("Answer: "); printf("Answer: ");
scanf("%s", answer); scanf("%s", answer);
if (strcmp(answer, "Harper Lee") == 0) {
if (strcmp(answer, "c") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" ___\n // \\\\\n(( ))\n \\ //\n ----\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is Harper Lee.\n\n");
printf("Incorrect. The answer is c.\n\n");
} }
printf("Question 2: Who painted the famous artwork 'The Starry Night'?\n\n"); printf("Question 2: Who painted the famous artwork 'The Starry Night'?\n\n");
@ -1229,6 +1299,7 @@ scanf("%s", answer);
if (strcmp(answer, "a") == 0) { if (strcmp(answer, "a") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" /\\_/\\\n( o.o )\n > ^ < \n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is a.\n\n"); printf("Incorrect. The answer is a.\n\n");
@ -1249,6 +1320,7 @@ scanf("%s", answer);
if (strcmp(answer, "d") == 0) { if (strcmp(answer, "d") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" _______\n / \\\n| Car |\n \\_______/\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is d.\n\n"); printf("Incorrect. The answer is d.\n\n");
@ -1256,15 +1328,17 @@ if (strcmp(answer, "d") == 0) {
printf("Question 2: Who invented the telephone?\n\n"); printf("Question 2: Who invented the telephone?\n\n");
printf("Hint: He was a Scottish-born American inventor.\n\n"); printf("Hint: He was a Scottish-born American inventor.\n\n");
printf("Options: Alexander Graham Bell, Thomas Edison, Nikola Tesla, Gutenberg\n\n");
printf("Options: a.)Alexander Graham Bell, b.)Thomas Edison, c.)Nikola Tesla, d.)Gutenberg\n\n");
printf("Answer: "); printf("Answer: ");
scanf("%s", answer); scanf("%s", answer);
if (strcmp(answer, "Alexander Graham Bell") == 0) {
if (strcmp(answer, "a") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" \\ / \\ \n \\ / \\ \n \\/_____\\ \n // \\ \n // \\ \n//__________\\\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is Alexander Graham Bell.\n\n");
printf("Incorrect. The answer is a.\n\n");
} }
return score; return score;
} }
@ -1276,15 +1350,17 @@ char answer[20];
printf("Round 8\n\n"); printf("Round 8\n\n");
printf("Question 1: Who played the lead role in the movie 'The Godfather'?\n\n"); printf("Question 1: Who played the lead role in the movie 'The Godfather'?\n\n");
printf("Hint: He is a legendary Hollywood actor.\n\n"); printf("Hint: He is a legendary Hollywood actor.\n\n");
printf("Options: Marlon Brando, Robert De Niro, Al Pacino, Jack Nicholson\n\n");
printf("Options: a.)Marlon Brando, b.)Robert De Niro, c.)Al Pacino, d.)Jack Nicholson\n\n");
printf("Answer: "); printf("Answer: ");
scanf("%s", answer); scanf("%s", answer);
if (strcmp(answer, "Marlon Brando") == 0) {
if (strcmp(answer, "a") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" /\\\n / \\ /\\\n / \\ / \\ \n/ \\ \\ \n\\ / / \n \\ / \\ / \n \\ /\\\n \\/\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is Marlon Brando.\n\n");
printf("Incorrect. The answer is a.\n\n");
} }
printf("Question 2: Who wrote the play 'Hamlet'?\n\n"); printf("Question 2: Who wrote the play 'Hamlet'?\n\n");
@ -1295,6 +1371,7 @@ scanf("%s", answer);
if (strcmp(answer, "a") == 0) { if (strcmp(answer, "a") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" /\\_/\\\n( o.o )\n > ^ < \n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is a.\n\n"); printf("Incorrect. The answer is a.\n\n");
@ -1315,6 +1392,7 @@ scanf("%s", answer);
if (strcmp(answer, "True") == 0) { if (strcmp(answer, "True") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf("_________\n| |\n| PC |\n|_________|\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is True.\n\n"); printf("Incorrect. The answer is True.\n\n");
@ -1328,6 +1406,7 @@ scanf("%s", answer);
if (strcmp(answer, "True") == 0) { if (strcmp(answer, "True") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" _________\n| |\n| Calculator |\n|_________|\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is True.\n\n"); printf("Incorrect. The answer is True.\n\n");
@ -1348,6 +1427,7 @@ scanf("%s", answer);
if (strcmp(answer, "H2O") == 0) { if (strcmp(answer, "H2O") == 0) {
printf("Correct!\n"); printf("Correct!\n");
printf(" ____\n / \\\n/________\\\n\\________/\n \\____/\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is H2O.\n\n"); printf("Incorrect. The answer is H2O.\n\n");
@ -1361,6 +1441,7 @@ scanf("%s", answer);
if (strcmp(answer, "b") == 0) { if (strcmp(answer, "b") == 0) {
printf("Correct!\n\n"); printf("Correct!\n\n");
printf(" /\\\n//\\\\\nV V\n");
score++; score++;
} else { } else {
printf("Incorrect. The answer is b.\n\n"); printf("Incorrect. The answer is b.\n\n");

Loading…
Cancel
Save