Browse Source

Refactoring: aligned texts, so its more organised.

main
fdlt3885 2 years ago
parent
commit
f4941e4f18
  1. 270
      src/main/quizproject.c

270
src/main/quizproject.c

@ -966,7 +966,7 @@ void B_show_time(void) {
time_info = localtime(&current_time);
strftime(time_string, sizeof(time_string), "%H:%M", time_info);
printf("The current time is: %s\n", time_string);
printf("The current time is: %s\n\n", time_string);
}
void B_displayWelcomeMessage(void) {
@ -978,12 +978,12 @@ void B_displayWelcomeMessage(void) {
}
void B_sayhello(char name[]){
printf("\t\t Hello %s \n\n", name);
printf(". Hello %s \n\n", name);
}
void B_username(void) {
char name[100] = {0};
printf("\t\t Please create a fun Username \n");
printf("Please create a fun Username\n\n");
scanf("%s", name);
B_sayhello(name);
}
@ -997,45 +997,45 @@ void b_entertostart() {
void B_userinfo(void){
char info[100] = {0};
printf("\t\t How old are you?\n");
printf("How old are you?\n");
scanf("%d", &info);
printf("\t\t Nice!!!\n");
printf("\t\t Nice!!!\n\n");
}
void B_displayGameInstructions() {
printf("\t\t To start this game, here are the instructions:\n\n # Read each question carefully and select the best answer from the choices provided.\n # You will receive points for each correct answer, and the game will keep track of your progress.\n # At the end of the game, you will be shown your final score and will have the option to play again.\n # Have fun and good luck!\n\n\n");
printf("To start this game, here are the instructions:\n\n # Read each question carefully and select the best answer from the choices provided.\n # You will receive points for each correct answer, and the game will keep track of your progress.\n # At the end of the game, you will be shown your final score and will have the option to play again.\n # Have fun and good luck!\n\n\n");
}
int B_testround(void) {
int score = 0;
char answer[20];
printf("Play a Test Round!\n");
printf("The points you get in this round will be added to the other rounds.\n");
printf("Question 1: What is the capital of Spain?\n");
printf("Hint: It is located in the center of the country.\n");
printf("Options: a.)Madrid b.)Barcelona c.)Valencia d.)Granada ");
printf("Play a Test Round!\n\n");
printf("The points you get in this round will be added to the other rounds.\n\n");
printf("Question 1: What is the capital of Spain?\n\n");
printf("Hint: It is located in the center of the country.\n\n");
printf("Options: a.)Madrid b.)Barcelona c.)Valencia d.)Granada\n\n ");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
printf("Question 2: What is the smallest planet in our solar system?\n");
printf("Hint: It is named after the messenger of the gods.\n");
printf("Options: a.)Earth b.)Mars c.)Mercury d.)Sun ");
printf("Question 2: What is the smallest planet in our solar system?\n\n");
printf("Hint: It is named after the messenger of the gods.\n\n");
printf("Options: a.)Earth b.)Mars c.)Mercury d.)Sun\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "c") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is c.\n");
printf("Incorrect. The answer is c.\n\n");
}
return score;
}
@ -1044,31 +1044,31 @@ 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("Round 1\n\n");
printf("Question 1: What is the value of x in the equation 2x + 1 = 7?\n\n");
printf("Hint: Subtract 1 from both sides and then divide both sides by 2.\n\n");
printf("Options: a.)1 b.)2 c.)3 d.)4\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "c") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is c.\n");
printf("Incorrect. The answer is c.\n\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("Question 2: What is the value of x in the equation 3x + 2 = 8?\n\n");
printf("Hint: Subtract 2 from both sides and then divide both sides by 3.\n\n");
printf("Options: a.)1 b.)2 c.)3 d.)4\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "b") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is b.\n");
printf("Incorrect. The answer is b.\n\n");
}
return score;
}
@ -1077,31 +1077,31 @@ int B_round2(void) {
int score = 0;
char answer[20];
printf("Round 2 - True or False\n");
printf("Question 1: The sun rises in the west.\n");
printf("Hint:Think about the Earth's rotation on its axis towards the east. \n");
printf("Options: a.)Ture b.)False");
printf("Round 2 - True or False\n\n");
printf("Question 1: The sun rises in the west.\n\n");
printf("Hint:Think about the Earth's rotation on its axis towards the east.\n\n");
printf("Options: a.)Ture b.)False\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "b") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is b.\n");
printf("Incorrect. The answer is b.\n\n");
}
printf("Question 2: The capital city of France is known as the 'City of Love'.\n");
printf("Hint: It is one of the most popular cities in the world.\n");
printf("Options: a.)Ture b.)False");
printf("Question 2: The capital city of France is known as the 'City of Love'.\n\n");
printf("Hint: It is one of the most popular cities in the world.\n\n");
printf("Options: a.)Ture b.)False\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
return score;
}
@ -1110,31 +1110,31 @@ int B_round3(void) {
int score = 0;
char answer[20];
printf("Round 3\n");
printf("Question 1: How many planets are in our solar system?\n");
printf("Hint: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune.");
printf("Options: a.)5 b.)6 c.)7 d.)8");
printf("Round 3\n\n");
printf("Question 1: How many planets are in our solar system?\n\n");
printf("Hint: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune.\n\n");
printf("Options: a.)5 b.)6 c.)7 d.)8\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "d") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is d.\n");
printf("Incorrect. The answer is d.\n\n");
}
printf("Question 2: How many bones are there in the human body? \n");
printf("Hint: This number may vary in childhood due to some bones merging together as the body grows and develops.");
printf("Options: a.)206 b.)205 c.)207 d.)204");
printf("Question 2: How many bones are there in the human body?\n\n");
printf("Hint: This number may vary in childhood due to some bones merging together as the body grows and develops.\n\n");
printf("Options: a.)206 b.)205 c.)207 d.)204\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
return score;
}
@ -1142,31 +1142,31 @@ int B_round3(void) {
int B_round4(void) {
int score = 0;
char answer[20];
printf("Round 4\n");
printf("Question 1: What is the capital of France?\n");
printf("Hint: It is known as the City of Light.\n");
printf("Options: a.)Paris b.)London c.)Madrid d.)Berlin");
printf("Round 4\n\n");
printf("Question 1: What is the capital of France?\n\n");
printf("Hint: It is known as the City of Light.\n\n");
printf("Options: a.)Paris b.)London c.)Madrid d.)Berlin\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
printf("Question 2: Who painted the Mona Lisa?\n");
printf("Hint: He was a famous Italian artist.\n");
printf("Options: a.)Leonardo da Vinci b.)Michelangelo c.)Raphael d.)Titian");
printf("Question 2: Who painted the Mona Lisa?\n\n");
printf("Hint: He was a famous Italian artist.\n\n");
printf("Options: a.)Leonardo da Vinci b.)Michelangelo c.)Raphael d.)Titian\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
return score;
}
@ -1174,31 +1174,31 @@ int B_round4(void) {
int B_round5(void) {
int score = 0;
char answer[20];
printf("Round 5\n");
printf("Question 1: Who invented the World Wide Web?\n");
printf("Hint: He is a British computer scientist.\n");
printf("Options: a.)Bill Gates b.)Steve Jobs c.)Tim Berners-Lee d.)Mark Zuckerberg");
printf("Round 5\\nn");
printf("Question 1: Who invented the World Wide Web?\n\n");
printf("Hint: He is a British computer scientist.\n\n");
printf("Options: a.)Bill Gates b.)Steve Jobs c.)Tim Berners-Lee d.)Mark Zuckerberg\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "c") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is c.\n");
printf("Incorrect. The answer is c.\n\n");
}
printf("Question 2: Who was the first person to walk on the Moon?\n");
printf("Hint: He was an American astronaut.\n");
printf("Options: a.)Neil Armstrong b.)Buzz Aldrin c.)Michael Collins d.)Pete Conrad");
printf("Question 2: Who was the first person to walk on the Moon?\n\n");
printf("Hint: He was an American astronaut.\n\n");
printf("Options: a.)Neil Armstrong b.)Buzz Aldrin c.)Michael Collins d.)Pete Conrad\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
return score;
}
@ -1207,31 +1207,31 @@ int B_round6(void) {
int score = 0;
char answer[20];
printf("Round 6\n");
printf("Question 1: Who wrote the novel 'To Kill a Mockingbird'?\n");
printf("Hint: She is known as an American novelist.\n");
printf("Options: a.)Jane Austen b.)Agatha Christie c.)Harper Lee d.)Mary Shelley");
printf("Round 6\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("Options: a.)Jane Austen b.)Agatha Christie c.)Harper Lee d.)Mary Shelley\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "c") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is c.\n");
printf("Incorrect. The answer is c.\n\n");
}
printf("Question 2: Who painted the famous artwork 'The Starry Night'?\n");
printf("Hint: He was a post-Impressionist painter.\n");
printf("Options: a.)Vincent van Gogh b.)Pablo Picasso c.)Leonardo da Vinci d.)Rembrandt");
printf("Question 2: Who painted the famous artwork 'The Starry Night'?\n\n");
printf("Hint: He was a post-Impressionist painter.\n\n");
printf("Options: a.)Vincent van Gogh b.)Pablo Picasso c.)Leonardo da Vinci d.)Rembrandt\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
return score;
}
@ -1240,31 +1240,31 @@ int B_round7(void) {
int score = 0;
char answer[20];
printf("Round 7\n");
printf("Question 1: Who directed the movie 'The Shawshank Redemption'?\n");
printf("Hint: He is known for his work in Hollywood.\n");
printf("Options: a.)Martin Scorsese b.)Francis Ford Coppola c.)Steven Spielberg d.)Frank Darabont");
printf("Round 7\n\n");
printf("Question 1: Who directed the movie 'The Shawshank Redemption'?\n\n");
printf("Hint: He is known for his work in Hollywood.\n\n");
printf("Options: a.)Martin Scorsese b.)Francis Ford Coppola c.)Steven Spielberg d.)Frank Darabont\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "d") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is d.\n");
printf("Incorrect. The answer is d.\n\n");
}
printf("Question 2: Who invented the telephone?\n");
printf("Hint: He was a Scottish-born American inventor.\n");
printf("Options: a.)Alexander Graham Bell b.)Thomas Edison c.)Nikola Tesla d.)Gutenberg");
printf("Question 2: Who invented the telephone?\n\n");
printf("Hint: He was a Scottish-born American inventor.\n\n");
printf("Options: a.)Alexander Graham Bell b.)Thomas Edison c.)Nikola Tesla d.)Gutenberg\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
return score;
}
@ -1273,31 +1273,31 @@ int B_round8(void) {
int score = 0;
char answer[20];
printf("Round 8\n");
printf("Question 1: Who played the lead role in the movie 'The Godfather'?\n");
printf("Hint: He is a legendary Hollywood actor.\n");
printf("Options: a.)Marlon Brando b.)Robert De Niro c.)Al Pacino d.)Jack Nicholson");
printf("Round 8\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("Options: a.)Marlon Brando b.)Robert De Niro c.)Al Pacino d.)Jack Nicholson\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
printf("Question 2: Who wrote the play 'Hamlet'?\n");
printf("Hint: He was an English playwright and poet.\n");
printf("Options: a.)William Shakespeare b.)Christopher Marlowe c.)Ben Jonson d.)John Milton");
printf("Question 2: Who wrote the play 'Hamlet'?\n\n");
printf("Hint: He was an English playwright and poet.\n\n");
printf("Options: a.)William Shakespeare b.)Christopher Marlowe c.)Ben Jonson d.)John Milton\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is a.\n");
printf("Incorrect. The answer is a.\n\n");
}
return score;
}
@ -1306,31 +1306,31 @@ int B_round9(void) {
int score = 0;
char answer[20];
printf("Round 9\n");
printf("Question 1: The median is the value separating the higher half from the lower half of a data set.\n");
printf("Hint: It is commonly used to represent the center of a dataset.");
printf("Options: a.)True b.)False");
printf("Round 9\n\n");
printf("Question 1: The median is the value separating the higher half from the lower half of a data set.\n\n");
printf("Hint: It is commonly used to represent the center of a dataset.\n\n");
printf("Options: a.)True b.)False\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is True.\n");
printf("Incorrect. The answer is True.\n\n");
}
printf("Question 2: The mode of a data set is the value that occurs most frequently.\n");
printf("Hint: The mode is a statistical measure that represents the most frequently occurring value in a dataset.");
printf("Options: a.)True b.)False");
printf("Question 2: The mode of a data set is the value that occurs most frequently.\n\n");
printf("Hint: The mode is a statistical measure that represents the most frequently occurring value in a dataset.\n\n");
printf("Options: a.)True b.)False\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "a") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is True.\n");
printf("Incorrect. The answer is True.\n\n");
}
return score;
}
@ -1339,10 +1339,10 @@ int B_round10(void) {
int score = 0;
char answer[20];
printf("Round 10\n");
printf("Question 1: What is the chemical formula for water?\n");
printf("Hint: It is composed of two hydrogen atoms and one oxygen atom.");
printf("Options: a.)CO2 b.)O2 c.)H2O d.)N2O");
printf("Round 10\n\n");
printf("Question 1: What is the chemical formula for water?\n\n");
printf("Hint: It is composed of two hydrogen atoms and one oxygen atom.\n\n");
printf("Options: a.)CO2 b.)O2 c.)H2O d.)N2O\n\n");
printf("Answer: ");
scanf("%s", answer);
@ -1350,50 +1350,50 @@ if (strcmp(answer, "c") == 0) {
printf("Correct!\n");
score++;
} else {
printf("Incorrect. The answer is c.\n");
printf("Incorrect. The answer is c.\n\n");
}
printf("Question 2: Who developed the theory of relativity?\n");
printf("Question 2: Who developed the theory of relativity?\n\n");
printf("Hint: A German-born physicist.");
printf("Options: a.)Isaac Newton b.)Albert Einstein c.)Stephen Hawking d.)Neil deGrasse Tyson");
printf("Options: a.)Isaac Newton b.)Albert Einstein c.)Stephen Hawking d.)Neil deGrasse Tyson\n\n");
printf("Answer: ");
scanf("%s", answer);
if (strcmp(answer, "b") == 0) {
printf("Correct!\n");
printf("Correct!\n\n");
score++;
} else {
printf("Incorrect. The answer is b.\n");
printf("Incorrect. The answer is b.\n\n");
}
return score;
}
void B_saythankyou(void){
printf("Dear player,\nI just wanted to take a moment to thank you for playing my game.\n It means a lot to me that you took the time to experience what I created.\n Your support and feedback are greatly appreciated.\n I hope you had a blast playing and I look forward to hearing more about your experience.\n Thank you again for your support and I hope to see you in future games!\n Best regards.");
printf("Dear player,\nI just wanted to take a moment to thank you for playing my game.\n It means a lot to me that you took the time to experience what I created.\n Your support and feedback are greatly appreciated.\n I hope you had a blast playing and I look forward to hearing more about your experience.\n Thank you again for your support and I hope to see you in future games!\n Best regards.\n\n\n");
}
void rate(void){
int rate;
printf("What would you rate my game out of 10?\n");
printf("What would you rate my game out of 10?\n\n");
scanf("%d", &rate);
printf("Thank you for your rating!\n");
printf("Your rating: %d/10\n", rate);
printf("Thank you for your rating!\n\n");
printf("Your rating: %d/10\n\n", rate);
}
void B_write_review(void) {
char response;
char review[100];
printf("Do you want to write a review (y/n)? ");
printf("Do you want to write a review (y/n)?\n\n ");
scanf(" %c", &response);
if (response == 'y') {
printf("Please write your review:\n");
printf("Please write your review:\n\n");
scanf("%s", review);
printf("Thank you for your review\n");
printf("Thank you for your review\n\n");
} else if (response == 'n') {
printf("Thank you for your time.\n");
printf("Thank you for your time.\n\n");
} else {
printf("Invalid response.\n");
printf("Invalid response.\n\n");
}
}

Loading…
Cancel
Save