You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1331 lines
45 KiB
1331 lines
45 KiB
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
#include <string.h>
|
|
#include <stdbool.h>
|
|
#include "quizproject.h"
|
|
|
|
char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B','A'};
|
|
|
|
int* randomNumber() {
|
|
srand(time(NULL));
|
|
int k = 0, p;
|
|
static int arr[13];
|
|
while(k<13){
|
|
int num =rand()%13;
|
|
for (p = 0; p < k; p++){
|
|
if(arr[p]==num){
|
|
break;
|
|
}
|
|
}
|
|
if(p==k){
|
|
arr[k++]=num;
|
|
}
|
|
}
|
|
return arr;
|
|
}
|
|
|
|
|
|
//-------smart_brain_quiz_begin----------
|
|
|
|
void e_press_key_start() {
|
|
char e_start_game;
|
|
scanf(" %c", &e_start_game);
|
|
e_start_game = toupper(e_start_game);
|
|
}
|
|
|
|
void e_display_instruction() {
|
|
printf("\t\t-------------------------------------------------------\n");
|
|
printf("\t\t To start this Quiz, here are the instructions\n");
|
|
printf("\t\t------------------------------------------------------\n\n");
|
|
printf("\t\t>>In the first, second Round, you answer True or false questions.<<\n\n");
|
|
printf("\t\t-------------------------------------------------------\n\n");
|
|
printf("\t\t>>Press any key and enter to begin the Quiz.<<\n\n");
|
|
e_press_key_start();
|
|
}
|
|
|
|
|
|
|
|
void e_usr_answr(char question[][100], char ans[], int initial, int end){
|
|
int i;
|
|
char user_answer;
|
|
for(i = initial; i < end; i++) {
|
|
printf("[%d]. %s", i + 1, question[i]);
|
|
scanf(" %c", &user_answer);
|
|
user_answer = toupper(user_answer);
|
|
while (user_answer != 'T' || user_answer != 'F' ){
|
|
if(user_answer == 'T' || user_answer == 'F') {
|
|
break;
|
|
} else {
|
|
printf("Input is invalid! Enter 'T' for true or 'F' for false [T/F]:\n");
|
|
scanf(" %c", &user_answer);
|
|
user_answer = toupper(user_answer);
|
|
}
|
|
}
|
|
bool ans1 = e_true_false(user_answer);
|
|
if(ans1 == ans[i]) {
|
|
score++;
|
|
track_r2_score++;
|
|
if(track_r2_score >= 2) {
|
|
track_r2_score = 0;
|
|
}
|
|
correct(score);
|
|
} else{
|
|
wrong(score);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void e_t_f_printQuestions(char askquestion[][100],char answers[]) {
|
|
int track_rounds = 0;
|
|
while(track_rounds < 1){
|
|
printf("\t\t---------------------------Round1-----------------------------\n");
|
|
printf("\t\t >>In this round you will be presented with 3 questions.<<\n");
|
|
printf("\t\t--------------------------------------------------------------\n\n");
|
|
int init = 0, end = 3;
|
|
e_usr_answr(askquestion,answers, init, end);
|
|
|
|
if(score < 2) {
|
|
break;
|
|
} else {
|
|
printf("\t\t---------------------------Round2-----------------------------\n");
|
|
printf("\t\t >>In this round you will be presented with 2 questions.<<\n");
|
|
printf("\t\t--------------------------------------------------------------\n\n");
|
|
init = 3, end = 5;
|
|
e_usr_answr(askquestion,answers, init, end);
|
|
}
|
|
track_rounds++;
|
|
}
|
|
|
|
}
|
|
|
|
void e_ask_questions(void) {
|
|
char e_t_f_question[][100] = {
|
|
"Mount Everest is the tallest mountain in the world:\n [T/F]: ",
|
|
"USA has the largest population in the world:\n [T/F]: ",
|
|
"Russia is the largest country by land size:\n [T/F]: ",
|
|
"Donald trump is the current president of USA:\n [T/F]: ",
|
|
"Cheese are made from plants:\n [T/F]: ",
|
|
"Tomato ist a fruit:\n [T/F]: ",
|
|
"Men have 2 X chromosomes:\n [T/F]: "
|
|
};
|
|
|
|
char e_t_f_solution[100] = {
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
true,
|
|
false
|
|
};
|
|
|
|
|
|
e_t_f_printQuestions(e_t_f_question, e_t_f_solution);
|
|
}
|
|
|
|
bool e_true_false(char choice) {
|
|
if (choice == 'T') {
|
|
return true;
|
|
} else if(choice == 'F') {
|
|
return false;
|
|
} else {
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
void e_questions_r3(void) {
|
|
|
|
char questions[][100] ={
|
|
"Which country started WW3?\n",
|
|
"What is the strongest Metal in the world?\n",
|
|
"which holy City do Muslim go on a pilgrimage to? \n"
|
|
};
|
|
|
|
char answers [][100] = {
|
|
"germany",
|
|
"tungsten",
|
|
"mecca"
|
|
};
|
|
|
|
e_printout_r3 (questions, answers);
|
|
}
|
|
|
|
|
|
void e_printout_r3 (char question[][100], char answers[][100]) {
|
|
int i;
|
|
char user_answer[100];
|
|
printf("\t\t---------------------------Round3-----------------------------\n");
|
|
printf("\t\t >>In this round you will be presented with 3 questions.<<\n");
|
|
printf("\t\t--------------------------------------------------------------\n\n");
|
|
for(i = 0; i < 3; i++) {
|
|
int k = 0;
|
|
printf("[%d]. %s",i+6,question[i]);
|
|
printf(" Your answer: ");
|
|
scanf("%s", user_answer);
|
|
int num = strlen(user_answer);
|
|
char ans[50];
|
|
for (int j = 0; j < 9; j++) {
|
|
ans[j] = answers[i][j];
|
|
}
|
|
|
|
for (int j = 0; j < strlen(ans); j++) {
|
|
if (ans[j] == tolower(user_answer[j])){
|
|
k++;
|
|
}
|
|
}
|
|
if (k == strlen(ans) && num == strlen(ans)) {
|
|
score++;
|
|
correct(score);
|
|
|
|
} else {
|
|
wrong(score);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
void e_smart_brain() {
|
|
e_display_instruction();
|
|
e_ask_questions();
|
|
if(score >=4 && track_r2_score ==0) {
|
|
e_questions_r3();
|
|
}
|
|
score = 0;
|
|
track_r2_score = 0;
|
|
}
|
|
//-------smart_brain_quiz_end------------
|
|
|
|
void displayWelcomeMessage(void) {
|
|
displayGameInstructions();
|
|
}
|
|
|
|
void displayGoodLuckMessage(void) {
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t GOOD LUCK! \n\n");
|
|
printf("\t\t------------------------------------------\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
}
|
|
|
|
void displayGameInstructions(void) {
|
|
printf("\t\t------------------------------------------\n");
|
|
printf("\t\t Welcome to Quiz Game!\n\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t To start this game, here are the Instructions\n\n");
|
|
printf("\t\t------------------------------------------\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t>>You will be presented with questions from\n");
|
|
printf("\t\tRound 1 to Round 3(Easy rounds) and Round\n");
|
|
printf("\t\t4 to Round 5(Hard rounds).<<\n");
|
|
printf("\t\t>>For every question you have four options (A, B, C, D).<<\n");
|
|
printf("\t\t>>For each question, you can either choose the\n");
|
|
printf("\t\tanswer from the four options or use a lifeline.<<\n\n");
|
|
printf("\t\t>>To Pass Through Round 1: You have to get 3 out of 5 correct.<<\n");
|
|
printf("\t\t>>To Pass Through Round 2: You have to get 3 out of 5 correct.<<\n");
|
|
printf("\t\t>>To Pass Through Round 3: You have to get 4 out of 5 correct.<<\n");
|
|
printf("\t\t>>To Pass Through Round 4: You have to get 4 out of 5 correct.<<\n");
|
|
printf("\t\t>>To Pass Through Round 5: You have to get 5 out of 5 correct.<<\n\n");
|
|
printf("\t\t>>If you choose the wrong answer, you lose a point.<<\n\n");
|
|
printf("\t\tYou may lose the game if not you don't have enough points to pass to the next round.\n\n");
|
|
printf("\t\tIf you use a lifeline and still choose the wrong answer, you lose the game.\n");
|
|
}
|
|
void displayLifelineInstructions(void) {
|
|
printf("\t\t>>You have the following lifelines available:<< \n");
|
|
printf("\t\t>>'F' 50-50: Eliminates two incorrect answers.<< \n");
|
|
printf("\t\t>>'H' Hint: Reveals a hint for the answer.<<\n");
|
|
}
|
|
|
|
void displayInstructions(void) {
|
|
displayWelcomeMessage();
|
|
displayLifelineInstructions();
|
|
displayGoodLuckMessage();
|
|
}
|
|
|
|
void correct(int score2){
|
|
printf("\nCorrect!\n");
|
|
printf("You have %d points now\n\n", score);
|
|
}
|
|
void wrong(int score1){
|
|
printf("\nWrong!\n");
|
|
printf("You have %d points now\n\n", score);
|
|
}
|
|
|
|
void fifty_fifty(int question_num) {
|
|
char qC[][100] = {
|
|
"A.Mount Everest\nB.Uludag",
|
|
"A.USA\nB.China",
|
|
"C.Amazon River\nD.The Nile River",
|
|
"A.San Fransisco\nB.San Diego",
|
|
"C.Merida\nD.Mexico city",
|
|
"C.Russia\nD.USA\n",
|
|
"A.Alaska\nB.Washington",
|
|
"C.Toronto\nD.Ottawa",
|
|
"A.Egypt\nB.Mexico",
|
|
"A.Surat Thani\nB.Bangkok",
|
|
"B.Mexico\nC.USA",
|
|
"C.Venice\nD.Naples",
|
|
"B.Cluny\nC.The Louvre"
|
|
};
|
|
printf("%s\n",qC[question_num]);
|
|
}
|
|
|
|
void hintForHardQuestions(int question_num) {
|
|
char hints[NUM_QUESTIONS][256] = {
|
|
"The city is known for its iconic landmarks and romantic atmosphere.",
|
|
"He was a general in the American Revolutionary War and is considered the Father of His Country.",
|
|
"This team has won the most NBA championships in history, with a total of 16 championships.",
|
|
"It is the lightest and most abundant chemical element in the universe.",
|
|
"This South Korean film became the first non-English language film to win the Academy Award for Best Picture."
|
|
};
|
|
printf("Hint: %s\n", hints[question_num]);
|
|
}
|
|
|
|
void fifty_fifty1(int question_num) {
|
|
char options[NUM_QUESTIONS][4][256] = {
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" },
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" },
|
|
{ "A) He", "B) H", "C) O", "D) Ne" },
|
|
{ "A) Parasite", "B) Joker", "C) Once Upon a Time in Hollywood", "D) 1917" }
|
|
};
|
|
char correct_answer = answers[question_num];
|
|
int num_incorrect = 0;
|
|
int incorrect_indices[2];
|
|
for (int i = 0; i < 4; i++) {
|
|
if (options[question_num][i][0] != correct_answer) {
|
|
incorrect_indices[num_incorrect] = i;
|
|
num_incorrect++;
|
|
}
|
|
if (num_incorrect == 2) {
|
|
break;
|
|
}
|
|
}
|
|
for (int i = 0; i < 2; i++) {
|
|
options[question_num][incorrect_indices[i]][0] = '\0';
|
|
}
|
|
// display remaining options
|
|
for (int i = 0; i < 4; i++) {
|
|
if (options[question_num][i][0] != '\0') {
|
|
printf("%s\n", options[question_num][i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
void printOutOption(char qS[][100], char qC[][100],char aS[], int initial, int end, int ranArr[]){
|
|
char response;
|
|
for (int i = initial; i < end; i++){
|
|
int randNum = ranArr[i];
|
|
printf("[%d] %s\n", i+1, qS[randNum]);
|
|
printf("%s\n", qC[randNum]);
|
|
printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): ");
|
|
scanf(" %c", &response);
|
|
response = toupper(response);
|
|
if (response == 'F') {
|
|
fifty_fifty(randNum);
|
|
printf("Enter your answer (A, B, C, or D): ");
|
|
scanf(" %c", &response);
|
|
response = toupper(response);
|
|
}
|
|
else if (response == 'H') {
|
|
hint(randNum);
|
|
printf("Enter your answer (A, B, C, or D): ");
|
|
scanf(" %c", &response);
|
|
response = toupper(response);
|
|
|
|
}
|
|
|
|
if(response == aS[randNum]){
|
|
score++;
|
|
correct(score);
|
|
} else {
|
|
wrong(score);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void looping(char qS[][100], char qC[][100], char aS[], int randArr[]){
|
|
|
|
int k = 0;
|
|
while(k < 1){
|
|
printf("\t\t--------------------Round 1-------------------\n\n");
|
|
printf(">>In this round you need to answer 3 questions correctly to move to Round 2<<\n\n");
|
|
|
|
int initial = 0, end = 2;
|
|
printOutOption(qS,qC,aS,initial,end,randArr);
|
|
|
|
if (score < 1) {
|
|
printf("You lost! Better luck next time\n");
|
|
break;
|
|
} else {
|
|
printf("\t\t--------------------Round 2-------------------\n\n");
|
|
printf(">>In this round you need to answer 2 questions correctly to move to Round 3<<\n\n");
|
|
|
|
initial = 2, end = 4;
|
|
printOutOption(qS,qC,aS,initial,end,randArr);
|
|
}
|
|
|
|
if (score < 1) {
|
|
printf("You lost! Better luck next time\n");
|
|
break;
|
|
} else {
|
|
printf("\t\t--------------------Round 3-------------------\n\n");
|
|
printf(">>In this round you need to answer 2 questions correctly to move to Round 4<<\n\n");
|
|
|
|
initial = 4, end = 7;
|
|
printOutOption(qS,qC,aS,initial,end,randArr);
|
|
|
|
}
|
|
|
|
k++;
|
|
}
|
|
if (score < 2) {
|
|
printf("\nYour final score: %d\n", score);
|
|
}
|
|
|
|
}
|
|
|
|
void ask_questions(void) {
|
|
char questions[][100] = {
|
|
"What is the name of the tallest mountain in the world?\n",
|
|
"Which country has the largest population in the world??\n",
|
|
"What is the name of the longest river in Africa?\n",
|
|
"What American city is the Golden Gate Bridge located in?\n",
|
|
"What is the capital of Mexico?\n",
|
|
"What is the name of the largest country in the world?\n",
|
|
"What U.S. state is home to no documented poisonous snakes?\n",
|
|
"What is the capital of Canada?\n",
|
|
"What country are the Great Pyramids of Giza located in?\n",
|
|
"What is the capital of Thailand?\n",
|
|
"In which country was Frida Kahlo born?\n",
|
|
"What present-day Italian city does Mt. Vesuvius overlook?\n",
|
|
"The Mona Lisa by Leonardo da Vinci is on display in which Paris museum?\n"
|
|
|
|
|
|
};
|
|
char possible_options[][100] = {
|
|
"A.Mount Everest\nB.Uludag\nC.K2\nD.Makalu",
|
|
"A.USA\nB.China\nC.Russia\nD.India",
|
|
"A.Missisipi River\nB.Yangtze River\nC.Amazon River\nD.The Nile River",
|
|
"A.San Fransisco\nB.San Diego\nC.New York\nD.Los Angeles",
|
|
"A.Oaxaca\nB.Puebla\nC.Merida\nD.Mexico city",
|
|
"A.India\nB.China\nC.Russia\nD.USA",
|
|
"A.Alaska\nB.Washington\nC.Ohio\nD.California",
|
|
"A.Vancouver\nB.Montreal\nC.Toronto\nD.Ottawa",
|
|
"A.Egypt\nB.Mexico\nC.Iceland\nD.Greenland",
|
|
"A.Surat Thani\nB.Bangkok\nC.Phuket\nD.Pattaya City",
|
|
"A.Austria\nB.Mexico\nC.USA\nD.India",
|
|
"A.Milan\nB.Rome\nC.Venice\nD.Naples",
|
|
"A.Carnavalet\nB.Cluny\nC.The Louvre\nD.Musee d'Orsay"
|
|
|
|
|
|
|
|
};
|
|
|
|
char answers[100] = {
|
|
'A',
|
|
'B',
|
|
'D',
|
|
'A',
|
|
'D',
|
|
'C',
|
|
'A',
|
|
'D',
|
|
'A',
|
|
'B',
|
|
'B',
|
|
'D',
|
|
'C'
|
|
|
|
};
|
|
|
|
int* randArr = randomNumber();
|
|
looping(questions, possible_options, answers, randArr);
|
|
|
|
|
|
}
|
|
|
|
void ask_hard_questions(void) {
|
|
|
|
|
|
int k = 0;
|
|
while (k < 1) {
|
|
|
|
int *lessFive = randomNumber();
|
|
int arr[5];
|
|
int p = 0;
|
|
for(int i = 0; i < 13; i++){
|
|
if(lessFive[i] < 5){
|
|
arr[p] = lessFive[i];
|
|
p++;
|
|
}
|
|
}
|
|
|
|
printf("\t\t--------------------Round 4-------------------\n\n");
|
|
printf(">>In this round you need to answer 2 questions correctly to move to Round 5<<\n\n");
|
|
|
|
|
|
char questions[NUM_QUESTIONS][256] = {
|
|
"What is the capital of France?",
|
|
"Who was the first president of the United States?",
|
|
"Which team won the most NBA championships?",
|
|
"What is the chemical symbol for hydrogen?",
|
|
"Which of the following movies won the Academy Award for Best Picture in 2020?"
|
|
};
|
|
char options[NUM_QUESTIONS][4][256] = {
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" },
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" },
|
|
{ "A) He", "B) H", "C) O", "D) Ne"},
|
|
{ "A) Parasite", "B) Joker", "C) Once Upon a Time in Hollywood", "D) 1917" }
|
|
};
|
|
|
|
char user_answers[NUM_QUESTIONS];
|
|
int lifelines[NUM_QUESTIONS] = { 1, 1,1,1,1};
|
|
int randNum;
|
|
for (int i = 0; i < 3; i++) {
|
|
randNum = arr[i];
|
|
printf("[%d] %s\n", i + 1, questions[randNum]);
|
|
for (int j = 0; j < 4; j++) {
|
|
printf("%s\n", options[randNum][j]);
|
|
}
|
|
printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): ");
|
|
char response;
|
|
scanf(" %c", &response);
|
|
response = toupper(response);
|
|
if (response == 'F' && lifelines[i] == 1) {
|
|
fifty_fifty1(randNum);
|
|
printf("Enter your answer (A, B, C, or D): ");
|
|
scanf(" %c", &user_answers[randNum]);
|
|
user_answers[randNum] = toupper(user_answers[randNum]);
|
|
lifelines[i] = 0;
|
|
}else if (response == 'H' && lifelines[i] == 1) {
|
|
hintForHardQuestions(randNum);
|
|
printf("Enter your answer (A, B, C, or D): ");
|
|
scanf(" %c", &user_answers[randNum]);
|
|
user_answers[randNum] = toupper(user_answers[randNum]);
|
|
lifelines[i] = 0;
|
|
}else {
|
|
user_answers[randNum] = response;
|
|
}
|
|
if (user_answers[randNum] == answers[randNum]) {
|
|
score++;
|
|
correct(score);
|
|
} else {
|
|
wrong(score);
|
|
}
|
|
}
|
|
if ( score < 4) {
|
|
printf("You lost! Better luck next time\n");
|
|
break;
|
|
} else {
|
|
printf("\t\t--------------------Round 5-------------------\n\n");
|
|
printf(">>This is the final round. Good Luck!<<\n\n");
|
|
for (int i = 3; i < 5; i++) {
|
|
|
|
randNum = arr[i];
|
|
printf("[%d] %s\n", i + 1, questions[randNum]);
|
|
for (int j = 0; j < 4; j++) {
|
|
printf("%s\n", options[randNum][j]);
|
|
}
|
|
printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): ");
|
|
char response;
|
|
scanf(" %c", &response);
|
|
response = toupper(response);
|
|
if (response == 'F' && lifelines[i] == 1) {
|
|
fifty_fifty1(randNum);
|
|
printf("Enter your answer (A, B, C, or D): ");
|
|
scanf(" %c", &user_answers[randNum]);
|
|
user_answers[randNum] = toupper(user_answers[randNum]);
|
|
lifelines[i] = 0;
|
|
}else if (response == 'H' && lifelines[i] == 1) {
|
|
hintForHardQuestions(randNum);
|
|
printf("Enter your answer (A, B, C, or D): ");
|
|
scanf(" %c", &user_answers[randNum]);
|
|
user_answers[randNum] = toupper(user_answers[randNum]);
|
|
lifelines[i] = 0;
|
|
}else {
|
|
user_answers[randNum] = response;
|
|
}
|
|
// check each answer
|
|
if (user_answers[randNum] == answers[randNum]) {
|
|
score++;
|
|
correct(score);
|
|
} else {
|
|
wrong(score);
|
|
}
|
|
}
|
|
}
|
|
k++;
|
|
}
|
|
printf("\nYour final score: %d\n", score);
|
|
}
|
|
|
|
|
|
void hint(int question_num) {
|
|
char qC[][100] = {
|
|
"Hint:The Tallest mountain is 8,849m.",
|
|
"Hint:It's population is 1.412 billion.",
|
|
"Hint:The longest river measures 6,650km.",
|
|
"Hint:The Golden States Warriors play there.\n",
|
|
"Hint:It is one of the oldest and largest cities in the Americas.\n",
|
|
"Hint:The area of the largest country is 17.1 million km2.\n",
|
|
"Hint:It is the coldest state in the US.",
|
|
"Hint:It is the 4th largest city in Canada.",
|
|
"Hint:It is a dry Country.",
|
|
"Hint:The capital has the longest city name in the world.",
|
|
"Hint:The Native language is Spanish.",
|
|
"Hint:The city that invented Swamp Buggy Racing.",
|
|
"Hint:It is the most visited art museum in the world."
|
|
|
|
};
|
|
printf("%s\n",qC[question_num]);
|
|
}
|
|
|
|
void displayThankYouMessage(void) {
|
|
printf("*******************************\n");
|
|
printf("Thank you for playing QuizGame!\n");
|
|
printf("*******************************\n\n");
|
|
}
|
|
|
|
void play_quizgame(void){
|
|
displayInstructions();
|
|
|
|
printf(">>Press 's' and Enter to start the Game<<\n");
|
|
char var, var1 = 's';
|
|
getchar();
|
|
while(var != var1) {
|
|
var = getchar();
|
|
}
|
|
printf("\n");
|
|
ask_questions();
|
|
if (score > 2){
|
|
ask_hard_questions();
|
|
}
|
|
displayThankYouMessage();
|
|
}
|
|
|
|
void v_factorlie(void){
|
|
char statements[][100] = {
|
|
"Tomatoes are fruits.", // fact
|
|
"The Great Wall of China is visible from space.", // lie
|
|
"Water freezes at 0 degrees Celsius.", // fact
|
|
"Napoleon Bonaparte ruled Germany at a time in history.", // fact
|
|
"Barack Obama was born in America." // lie
|
|
|
|
};
|
|
char answers[] = {'F','L','F','F','L'}; // L for lie, F for fact
|
|
int num_statements = sizeof(statements) / sizeof(statements[0]);
|
|
int score = 0;
|
|
|
|
printf("\nWelcome to the Fact or Lie Quiz!\n\n");
|
|
for (int i = 0; i < num_statements; i++) {
|
|
char user_answer;
|
|
printf("Statement %d: %s\n\n", i + 1, statements[i]);
|
|
printf("Is this statement a fact (F) or a lie (L)?\n");
|
|
printf("Your answer: \n");
|
|
scanf(" %c", &user_answer);
|
|
user_answer = toupper(user_answer);
|
|
if (user_answer == answers[i]) {
|
|
score++;
|
|
printf("Correct! You get a point.\n\n");
|
|
} else {
|
|
printf("Sorry, its incorrect. No points!\n\n");
|
|
}
|
|
}
|
|
printf("Your final score is %d out of %d.\n", score, num_statements);
|
|
|
|
}
|
|
|
|
void play_factorlie() {
|
|
printf("**********************\n");
|
|
printf("Playing Fact or Lie!\n");
|
|
printf("**********************\n");
|
|
v_factorlie();
|
|
printf("**********************************\n");
|
|
printf("Thank you for playing Fact or Lie!\n");
|
|
printf("**********************************\n");
|
|
}
|
|
|
|
void play_milliongame() {
|
|
printf("Playing who wants to be a millionaire...\n");
|
|
|
|
int million_i = 0, million_k = 0;;
|
|
char million_user_answers[round];
|
|
char million_std_answers[round] = {'B', 'A', 'A','B', 'A', 'A','B', 'A', 'A','B', 'A', 'A','B', 'A', 'A'};
|
|
int million_stay_in_game = 0, million_reward = 0, million_checkpoint = 0, million_count_replace = 0;
|
|
int million_lifeline_hint = 1, million_lifeline_delete = 1, million_lifeline_friend = 1;
|
|
|
|
char questions[round][256] = {
|
|
"What is the capital of France?",
|
|
"Who was the first president of the United States?",
|
|
"Which team won the most NBA championships?",
|
|
"What is the capital of France?",
|
|
"Who was the first president of the United States?",
|
|
"Which team won the most NBA championships?",
|
|
"What is the capital of France?",
|
|
"Who was the first president of the United States?",
|
|
"Which team won the most NBA championships?",
|
|
"What is the capital of France?",
|
|
"Who was the first president of the United States?",
|
|
"Which team won the most NBA championships?",
|
|
"What is the capital of France?",
|
|
"Who was the first president of the United States?",
|
|
"Which team won the most NBA championships?"
|
|
};
|
|
char answers[round][4][256] = {
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" },
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" },
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" },
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" },
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" },
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" },
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" },
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" },
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" },
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" }
|
|
};
|
|
|
|
while(million_i < round && million_stay_in_game == 0){
|
|
|
|
printf("You have %d:Fifty/Fifty\t%d:Phone a Friend\t%d:Hint\t\n",million_lifeline_delete,million_lifeline_friend,million_lifeline_hint);
|
|
|
|
printf("\n%s\n",questions[million_i]);
|
|
for(int j=0;j<4;j++){
|
|
printf("%s\n",answers[million_i][j]);
|
|
}
|
|
|
|
point_one:
|
|
|
|
printf("Enter a valid Response: ");
|
|
scanf(" %c", &million_user_answers[million_i]);
|
|
million_user_answers[million_i] = toupper(million_user_answers[million_i]);
|
|
|
|
switch(million_user_answers[million_i]){
|
|
case 'A':
|
|
if(million_user_answers[million_i] == million_std_answers[million_i]){
|
|
printf("\nCorrect!");
|
|
million_reward = million_reward + (10000 * (million_i+1));
|
|
printf("\n%d\n",million_reward);
|
|
|
|
if(million_i == 0){
|
|
million_checkpoint = 0;
|
|
}
|
|
else if(million_i == 4){
|
|
million_checkpoint = million_reward;
|
|
}
|
|
else if(million_i == 9)
|
|
million_checkpoint = million_reward;
|
|
else{}
|
|
|
|
}
|
|
else{
|
|
printf("\nIncorrect!");
|
|
million_stay_in_game == 1;
|
|
}
|
|
break;
|
|
case 'B':
|
|
if(million_user_answers[million_i] == million_std_answers[million_i]){
|
|
million_reward = million_reward + (10000 * (million_i+1));
|
|
printf("\n%d\n",million_reward);
|
|
printf("\nCorrect!");
|
|
|
|
if(million_i == 0){
|
|
million_checkpoint = 0;
|
|
}
|
|
else if(million_i == 4){
|
|
million_checkpoint = million_reward;
|
|
}
|
|
else if(million_i == 9)
|
|
million_checkpoint = million_reward;
|
|
else{}
|
|
|
|
}
|
|
else{
|
|
printf("\nIncorrect!");
|
|
million_stay_in_game == 1;
|
|
}
|
|
break;
|
|
case 'C':
|
|
if(million_user_answers[million_i] == million_std_answers[million_i]){
|
|
million_reward = million_reward + (10000 * (million_i+1));
|
|
printf("\n%d\n",million_reward);
|
|
printf("\nCorrect!");
|
|
|
|
if(million_i == 0){
|
|
million_checkpoint = 0;
|
|
}
|
|
else if(million_i == 4){
|
|
million_checkpoint = million_reward;
|
|
}
|
|
else if(million_i == 9)
|
|
million_checkpoint = million_reward;
|
|
else{}
|
|
|
|
}
|
|
else{
|
|
printf("\nIncorrect!");
|
|
million_stay_in_game == 1;
|
|
}
|
|
break;
|
|
case 'D':
|
|
if(million_user_answers[million_i] == million_std_answers[million_i]){
|
|
million_reward = million_reward + (10000 * (million_i+1));
|
|
printf("\n%d\n",million_reward);
|
|
printf("\nCorrect!");
|
|
|
|
if(million_i == 0){
|
|
million_checkpoint = 0;
|
|
}
|
|
else if(million_i == 4){
|
|
million_checkpoint = million_reward;
|
|
}
|
|
else if(million_i == 9)
|
|
million_checkpoint = million_reward;
|
|
else{}
|
|
}
|
|
else{
|
|
printf("\nIncorrect!");
|
|
million_stay_in_game == 1;
|
|
}
|
|
break;
|
|
case 'H':
|
|
if(million_lifeline_hint != 1){
|
|
printf("\nHint already used\n");
|
|
goto point_one;
|
|
} else {
|
|
million_lifeline_hint = 0;
|
|
printf("Hint would be displayed here\n");
|
|
goto point_one;
|
|
}
|
|
break;
|
|
case 'F':
|
|
if(million_lifeline_delete != 1){
|
|
printf("\nFifty/Fifty lifeline already used\n");
|
|
goto point_one;
|
|
}
|
|
else {
|
|
million_lifeline_delete = 0;
|
|
printf("\nComputer will now MARK two wrong answers...\n");
|
|
|
|
while(million_k < 4 && million_count_replace < 2){
|
|
if(answers[million_i][million_k][0] != million_std_answers[million_i]){
|
|
answers[million_i][million_k][0] = 'X';
|
|
million_count_replace = million_count_replace + 1;
|
|
}
|
|
million_k++;
|
|
}
|
|
for(int million_n = 0; million_n < 4; million_n++){
|
|
printf("%s\n",answers[million_i][million_n]);
|
|
}
|
|
goto point_one;
|
|
}
|
|
break;
|
|
case 'P':
|
|
if(million_lifeline_friend != 1){
|
|
printf("\nLifeline Friend already used\n");
|
|
goto point_one;
|
|
}
|
|
else{
|
|
million_lifeline_friend = 0;
|
|
printf("\nYou can now ask a friend for help...\n");
|
|
for(int j=0;j<4;j++){
|
|
printf("%s\n",answers[million_i][j]);
|
|
}
|
|
goto point_one;
|
|
}
|
|
break;
|
|
case 'T':
|
|
million_stay_in_game = 1;
|
|
break;
|
|
default:
|
|
goto point_one;
|
|
}
|
|
|
|
million_i++;
|
|
}
|
|
printf("\n%d\n",million_checkpoint);
|
|
// code for game 3 goes here
|
|
}
|
|
|
|
void v_guessingGame(void){
|
|
int secret_number, guess;
|
|
srand(time(NULL));
|
|
secret_number = rand() % 100 + 1;
|
|
printf("Guess the Number!\n\n");
|
|
printf("I am thinking of a number between 1 and 100. Can you guess what it is?\n");
|
|
while (1) {
|
|
printf("Enter your guess: ");
|
|
scanf("%d", &guess);
|
|
if (guess > secret_number) {
|
|
printf("Too high! Try again.\n");
|
|
} else if (guess < secret_number) {
|
|
printf("Too low! Try again.\n");
|
|
} else {
|
|
printf("Congratulations, you found the secret number!\n");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void play_guessingGame() {
|
|
printf("*************************\n");
|
|
printf("Playing Guess the Number!\n");
|
|
printf("*************************\n\n");
|
|
v_guessingGame();
|
|
printf("****************************************\n");
|
|
printf("Thank you for playing Guess the Number!\n");
|
|
printf("****************************************\n");
|
|
}
|
|
|
|
void v_guessTheWord(char word[], char guessed[]) {
|
|
int i;
|
|
for (i = 0; i < strlen(word); i++) {
|
|
if (guessed[i]) {
|
|
printf("%c ", word[i]);
|
|
} else {
|
|
printf("_ ");
|
|
}
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
void play_guessTheWord() {
|
|
char word[] = "Fulda";
|
|
char guessed[MAX_WORD_LENGTH] = {0};
|
|
int lives = MAX_LIVES;
|
|
int word_length = strlen(word);
|
|
char guess;
|
|
guess = toupper(guess);
|
|
|
|
printf("***********************\n");
|
|
printf("Playing Guess the Word!\n");
|
|
printf("***********************\n\n");
|
|
|
|
printf("IMPORTANT: The first letter is a capital letter!\n\n");
|
|
|
|
while (lives > 0) {
|
|
int i;
|
|
int correct = 0;
|
|
|
|
printf("Lives: %d\n", lives);
|
|
v_guessTheWord(word, guessed);
|
|
printf("Guess a letter: ");
|
|
scanf(" %c", &guess);
|
|
|
|
|
|
for (i = 0; i < word_length; i++) {
|
|
if (word[i] == guess) {
|
|
guessed[i] = guess;
|
|
correct = 1;
|
|
}
|
|
}
|
|
|
|
if (!correct) {
|
|
lives--;
|
|
}
|
|
|
|
if (strcmp(word, guessed) == 0) {
|
|
printf("You win! The word was: %s\n\n", word);
|
|
printf("*************************************\n");
|
|
printf("Thank you for playing Guess the Word!\n");
|
|
printf("*************************************\n");
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (lives == 0) {
|
|
printf("You lose! The word was: %s\n\n", word);
|
|
printf("*************************************\n");
|
|
printf("Thank you for playing Guess the Word!\n");
|
|
printf("*************************************\n");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void B_show_time(void) {
|
|
time_t current_time;
|
|
struct tm *time_info;
|
|
char time_string[9];
|
|
|
|
time(¤t_time);
|
|
time_info = localtime(¤t_time);
|
|
|
|
strftime(time_string, sizeof(time_string), "%H:%M", time_info);
|
|
printf("The current time is: %s\n", time_string);
|
|
}
|
|
|
|
void B_displayWelcomeMessage(void) {
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t Welcome to The EPIC GAME \n\n");
|
|
printf("\t\t------------------------------------------\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
}
|
|
|
|
void B_sayhello(char name[]){
|
|
printf("\t\t Hello %s \n\n", name);
|
|
}
|
|
|
|
void B_username(void) {
|
|
char name[100] = {0};
|
|
printf("\t\t Please create a fun Username \n");
|
|
scanf("%s", name);
|
|
B_sayhello(name);
|
|
}
|
|
|
|
void b_entertostart() {
|
|
char enter;
|
|
printf("\t\t Press 'any key' to begin \n");
|
|
scanf(" %c", &enter);
|
|
enter = toupper(enter);
|
|
}
|
|
|
|
void B_userinfo(void){
|
|
char info[100] = {0};
|
|
printf("\t\t How old are you?\n");
|
|
scanf("%d", &info);
|
|
printf("\t\t Nice!!!\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");
|
|
}
|
|
|
|
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("Options: a.)Madrid b.)Barcelona c.)Valencia d.)Granada ");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "a") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n");
|
|
}
|
|
|
|
printf("Question 2: What is the smallest planet in our solar system?\n");
|
|
printf("Options: a.)Earth b.)Mars c.)Mercury d.)Sun ");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "c") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is c.\n");
|
|
}
|
|
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;
|
|
}
|
|
|
|
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("Options: a.)Ture b.)False");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "b") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is b.\n");
|
|
}
|
|
|
|
printf("Question 2: The capital city of France is known as the 'City of Love'.\n");
|
|
printf("Options: a.)Ture b.)False");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "a") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
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("Options: a.)5 b.)6 c.)7 d.)8");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "d") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is d.\n");
|
|
}
|
|
|
|
printf("Question 2: How many bones are there in the human body? \n");
|
|
printf("Options: a.)206 b.)205 c.)207 d.)204");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "a") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
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("Options: a.)Paris b.)London c.)Madrid d.)Berlin");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "a") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n");
|
|
}
|
|
|
|
printf("Question 2: Who painted the Mona Lisa?\n");
|
|
printf("Options: a.)Leonardo da Vinci b.)Michelangelo c.)Raphael d.)Titian");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "a") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
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("Options: a.)Bill Gates b.)Steve Jobs c.)Tim Berners-Lee d.)Mark Zuckerberg");
|
|
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: Who was the first person to walk on the Moon?\n");
|
|
printf("Options: a.)Neil Armstrong b.)Buzz Aldrin c.)Michael Collins d.)Pete Conrad");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "a") == 0) {
|
|
printf("Correct!\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
void b_epic_game() {
|
|
B_displayWelcomeMessage();
|
|
b_entertostart();
|
|
B_username();
|
|
B_userinfo();
|
|
B_displayGameInstructions();
|
|
B_show_time();
|
|
int total_score = 0;
|
|
total_score += B_testround();
|
|
total_score += B_round1();
|
|
total_score += B_round2();
|
|
total_score += B_round3();
|
|
total_score += B_round4();
|
|
total_score += B_round5();
|
|
}
|
|
|
|
|
|
|
|
void feedbackForm(void){
|
|
int rating;
|
|
char feedback[1000];
|
|
|
|
printf("\nQuick Feedback Form:\n\n");
|
|
printf("On a scale of 1 to 5, how would you rate the quiz? (1 being poor and 5 being excellent): ");
|
|
scanf("%d", &rating);
|
|
getchar();
|
|
printf("Please provide any additional feedback: ");
|
|
fgets(feedback, sizeof(feedback), stdin);
|
|
|
|
printf("\nThank you for your feedback!\n");
|
|
printf("Your rating: %d/5\n", rating);
|
|
printf("Your feedback: %s\n", feedback);
|
|
}
|
|
|
|
void displayCredits(void) {
|
|
printf("*******************************\n");
|
|
printf("Thank you for playing our Game!\n");
|
|
printf("*******************************\n\n");
|
|
printf("This game was developed as a project for Hochschule Fulda. \nCreated by Vedant Bodhe, Emmanuel Afanyede, Berke Sevenler and Gabriel Tchakunte.\n\n");
|
|
printf("Special thanks to:\n");
|
|
printf("- Herr Thomas Papendieck (Lecturer: Programmiermethoden)\n");
|
|
printf("- Frau Monika Schak (Lecturer: Programming-1 in C)\n");
|
|
}
|
|
|
|
int main() {
|
|
int choice;
|
|
printf("Welcome to the Game Menu!\n");
|
|
printf("\t\t----------------------------\n\n");
|
|
printf("\t\t----------------------------\n\n");
|
|
printf("\t\t Welcome! \n\n");
|
|
printf("\t\t----------------------------\n");
|
|
printf("\t\t----------------------------\n\n");
|
|
printf("\t\tPress 'Enter' to join the Game \n");
|
|
char joinGame;
|
|
scanf("%c", &joinGame);
|
|
joinGame = toupper(joinGame);
|
|
if (joinGame != ' ') {
|
|
char vorName[100] ={0};
|
|
char nachName[100] ={0};
|
|
printf("\t\tPlease enter your First Name \n");
|
|
scanf("%s", vorName);
|
|
printf("\t\tPlease enter your Surname \n");
|
|
scanf("%s", nachName);
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t Hello %s %s! \n\n", vorName, nachName);
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\t\t------------------------------------------\n\n");
|
|
printf("\n\nPlease choose one of the number options from below\n\n");
|
|
}
|
|
|
|
int jump_to_menu = 0;
|
|
|
|
while (choice != 8 || jump_to_menu) {
|
|
printf("Welcome to the Game Menu!\n");
|
|
printf("1. QuizGame\n");
|
|
printf("2. Fact or Lie?\n");
|
|
printf("3. Who wants to be a millionaire\n");
|
|
printf("4. Guess the Number!\n");
|
|
printf("5. Guess the Word!\n");
|
|
printf("6. Smart Brain\n");
|
|
printf("7. Epic Game\n");
|
|
printf("8. Exit\n");
|
|
printf("Enter your choice: ");
|
|
scanf("%d", &choice);
|
|
|
|
switch(choice) {
|
|
case 1:
|
|
play_quizgame();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 2:
|
|
play_factorlie();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 3:
|
|
play_milliongame();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 4:
|
|
play_guessingGame();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 5:
|
|
play_guessTheWord();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 6:
|
|
e_smart_brain();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 7:
|
|
b_epic_game();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 8:
|
|
printf("\nThank you for trying our C code!\n");
|
|
break;
|
|
default:
|
|
printf("Invalid choice!\n");
|
|
}
|
|
if (jump_to_menu) {
|
|
jump_to_menu = 0;
|
|
printf("\nType any key and press enter to jump back to the menu.\n");
|
|
char jump_key;
|
|
scanf(" %c", &jump_key);
|
|
jump_key = toupper(jump_key);
|
|
}
|
|
}
|
|
feedbackForm();
|
|
displayCredits();
|
|
return 0;
|
|
}
|
|
|
|
|
|
|