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.
2087 lines
68 KiB
2087 lines
68 KiB
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
#include <string.h>
|
|
#include <stdbool.h>
|
|
#include <unistd.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[100];
|
|
while(k<100){
|
|
int num =rand()%100;
|
|
for (p = 0; p < k; p++){
|
|
if(arr[p]==num){
|
|
break;
|
|
}
|
|
}
|
|
if(p==k){
|
|
arr[k++]=num;
|
|
}
|
|
}
|
|
return arr;
|
|
}
|
|
|
|
|
|
//------------Math_quiz_begin------------
|
|
|
|
void math_choose_question(int num) {
|
|
char choose [][100] = {
|
|
"what is 1 + 1\n",
|
|
"what is 4 + 3\n",
|
|
"what is 4 * 8\n",
|
|
"what is ((6*8)/4)+2\n"
|
|
};
|
|
printf("%s", choose[num]);
|
|
}
|
|
|
|
int math_answer(int num1) {
|
|
int ans[]= {
|
|
2,
|
|
7,
|
|
32,
|
|
14
|
|
};
|
|
return ans[num1];
|
|
}
|
|
|
|
void math_display_choice(){
|
|
int user_answer;
|
|
for(int i = 0; i < 4; i++){
|
|
math_choose_question(i);
|
|
printf("Answer: ");
|
|
scanf("%d", &user_answer);
|
|
int quiz_answer = math_answer(i);
|
|
if(quiz_answer == user_answer){
|
|
printf("Correct!\n");
|
|
} else {
|
|
printf("Wrong!\n");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//------------Math_quiz_end--------------
|
|
|
|
|
|
|
|
|
|
//-------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 hint_anagram(int hint_num) {
|
|
char hint_questions[][100] = {
|
|
"d_v_l_p_e_t",
|
|
"i_t_r_a_i_nal",
|
|
"p_l__im_ge",
|
|
"o_e__t_on",
|
|
"p_p_la__on",
|
|
"p__g__ss",
|
|
"c_a__en_e",
|
|
"e_ce__en_e",
|
|
"al_o_ati__"
|
|
};
|
|
printf("Here is your hint: %s\n",hint_questions[hint_num]);
|
|
}
|
|
|
|
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");
|
|
printf("\t\t>>In the third Round, you answer questions which test your General knowledge.<< \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 randChar[]){
|
|
int i;
|
|
char user_answer;
|
|
for(i = initial; i < end; i++) {
|
|
int rNum = randChar[i];
|
|
printf("[%d]. %s", i + 1, question[rNum]);
|
|
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[rNum]) {
|
|
score++;
|
|
if(i > 2) {
|
|
track_r2_score++;
|
|
}
|
|
|
|
correct(score);
|
|
} else{
|
|
wrong(score);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void e_t_f_printQuestions(char askquestion[][100],char answers[], int charArr[]) {
|
|
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>>You need to answer 2 questions correctly to move to Round 2<<\n");
|
|
printf("\t\t--------------------------------------------------------------\n\n");
|
|
int init = 0, end = 3;
|
|
e_usr_answr(askquestion,answers, init, end,charArr);
|
|
|
|
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>>A false answer to any questions means you lose and out of the Game<<\n");
|
|
printf("\t\t--------------------------------------------------------------\n\n");
|
|
init = 3, end = 5;
|
|
e_usr_answr(askquestion,answers, init, end, charArr);
|
|
}
|
|
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
|
|
};
|
|
|
|
int* randChar = randomNumber();
|
|
int charArr[7];
|
|
int p1 = 0;
|
|
for(int k = 0; k < 100; k++) {
|
|
if (randChar[k] < 7) {
|
|
charArr[p1] = randChar[k];
|
|
p1++;
|
|
}
|
|
}
|
|
e_t_f_printQuestions(e_t_f_question, e_t_f_solution, charArr);
|
|
}
|
|
|
|
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 guess_word_questions() {
|
|
char guess_words[][100] = {
|
|
"fi__s__d",
|
|
"b__ke_",
|
|
"p__si__",
|
|
"_i__ons__",
|
|
"_vi_e__e",
|
|
"de__l__me__",
|
|
"w___i_e",
|
|
"r___d___e",
|
|
"se_t_em__t",
|
|
"___lia___ta_y",
|
|
"m_n_s__r__s",
|
|
"si__if_ca__e",
|
|
"ch__le_g_"
|
|
};
|
|
|
|
char guess_solution [][100] = {
|
|
"nihe",
|
|
"uct",
|
|
"hycs",
|
|
"wscin",
|
|
"ednc",
|
|
"veopnt",
|
|
"ebst",
|
|
"esienc",
|
|
"tlen",
|
|
"parmenr",
|
|
"oateie",
|
|
"gninc",
|
|
"alne"
|
|
};
|
|
|
|
char word_guessed[][100] = {
|
|
"finished",
|
|
"bucket",
|
|
"physics",
|
|
"wisconsin",
|
|
"evidence",
|
|
"development",
|
|
"website",
|
|
"residence",
|
|
"settlement",
|
|
"Parliamentary",
|
|
"monasteries",
|
|
"significance",
|
|
"challenge"
|
|
};
|
|
int* randArr0 = randomNumber();
|
|
int arr0[13];
|
|
int p = 0;
|
|
for(int i = 0; i < 100; i++){
|
|
if(randArr0[i] < 13){
|
|
arr0[p] = randArr0[i];
|
|
p++;
|
|
}
|
|
}
|
|
print_guess_word_question (guess_words, guess_solution,word_guessed, arr0);
|
|
}
|
|
|
|
|
|
void print_guess_word_question (char guessWord[][100], char guessSolution[][100],char guessedWord[][100], int randArr[]){
|
|
|
|
printf("\t\t---------------------------Round4-----------------------------\n\n");
|
|
printf("\t\t >>You have to guess what word it is by filling\n");
|
|
printf(" in the empty space<<\n\n");
|
|
printf("\t\t-------------------------------------------------------------\n\n");
|
|
|
|
|
|
for (int j = 0; j < 4; j ++) {
|
|
int runNum = randArr[j];
|
|
char usr_ans[100];
|
|
int k = 0;
|
|
printf("[%d]. Guess the word by finding the missing Letters:\n %s: \n",j+1, guessWord[runNum]);
|
|
printf(" Your answer: ");
|
|
scanf("%s",usr_ans);
|
|
|
|
char arr[30];
|
|
for(int p = 0; p < 30; p++) {
|
|
arr[p] = guessSolution[runNum][p];
|
|
|
|
if (guessSolution[runNum][p] == '\0') {
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < strlen(arr); i++) {
|
|
|
|
if(usr_ans[i] == arr[i]) {
|
|
k++;
|
|
}
|
|
}
|
|
|
|
if (k == strlen(arr) && strlen(usr_ans) == strlen(arr)) {
|
|
score++;
|
|
printf("Correct!\nYou have %d points\n",score);
|
|
printf("You guessed right! The word is rightfully, %s!\n\n", guessedWord[runNum]);
|
|
} else {
|
|
printf("Wrong!\nYou have %d points\n", score);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void e_printout(char print_out_questn[][100], char questions[][100],int randArr[]) {
|
|
|
|
|
|
printf("\t\t---------------------------Round5-----------------------------\n\n");
|
|
printf("\t\t >>You are represented with an Anagram in each question.<<\n");
|
|
printf(" >>Determine what word it is.<<\n\n");
|
|
printf("\t\t-------------------------------------------------------------\n\n");
|
|
char usr_ans[100];
|
|
|
|
for(int i = 0; i < 4; i++) {
|
|
int rNum = randArr[i];
|
|
printf("[%d] Guess is the correct word for this anagram: %s\n", i+1, print_out_questn[rNum]);
|
|
printf("Answer: ");
|
|
scanf("%s", usr_ans);
|
|
for(int j = 0; j < strlen(usr_ans); j++) {
|
|
if (toupper(usr_ans[j]) == 'H' && strlen(usr_ans) == 1) {
|
|
hint_anagram(rNum);
|
|
printf("Answer: ");
|
|
scanf("%s", usr_ans);
|
|
}
|
|
}
|
|
int p = 0;
|
|
while(p < strlen(usr_ans)) {
|
|
usr_ans[p] = tolower(usr_ans[p]);
|
|
p++;
|
|
}
|
|
int k = 0;
|
|
for (int j = 0; j < strlen(print_out_questn[rNum]); j ++){
|
|
if(usr_ans[j] == questions[rNum][j]) {
|
|
k++;
|
|
}
|
|
|
|
}
|
|
if (k == strlen(print_out_questn[rNum]) && strlen(usr_ans) == strlen(print_out_questn[rNum])) {
|
|
score++;
|
|
printf("Correct!\nYou have %d points\n", score);
|
|
|
|
} else {
|
|
printf("Wrong!\n");
|
|
printf("The word is: %s\n", questions[rNum]);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void e_anagram_questions() {
|
|
char questions[][100] = {
|
|
"development",
|
|
"international",
|
|
"pilgrimage",
|
|
"operation",
|
|
"population",
|
|
"progress"
|
|
};
|
|
|
|
char print_questions[100][100];
|
|
int *charNum = randomNumber();
|
|
char arr[100];
|
|
for (int i = 0; i < 6; i++) {
|
|
for(int j = 0; j < 100; j++) {
|
|
arr[j] = questions[i][j];
|
|
if (questions[i][j] == '\0') {
|
|
break;
|
|
}
|
|
}
|
|
//random array to mix letters
|
|
int len = (int)strlen(arr);
|
|
int charArr[len];
|
|
int p = 0;
|
|
for(int l = 0; l < 100; l++) {
|
|
if (charNum[l] < len) {
|
|
charArr[p] = charNum[l];
|
|
p++;
|
|
}
|
|
}
|
|
int randNum, f=0;
|
|
for(int k = 0; k < strlen(arr); k++){
|
|
randNum = charArr[k];
|
|
print_questions[i][f] = arr[randNum];
|
|
f++;
|
|
}
|
|
}
|
|
|
|
//random geneator for questionmix
|
|
int charArr2[6];
|
|
int p1 = 0;
|
|
for(int l = 0; l < 100; l++) {
|
|
if (charNum[l] < 6) {
|
|
charArr2[p1] = charNum[l];
|
|
p1++;
|
|
}
|
|
}
|
|
|
|
e_printout(print_questions,questions, charArr2);
|
|
}
|
|
|
|
|
|
void e_smart_brain() {
|
|
e_display_instruction();
|
|
e_ask_questions();
|
|
if(score >=4 && track_r2_score ==2) {
|
|
e_questions_r3();
|
|
}
|
|
guess_word_questions();
|
|
e_anagram_questions();
|
|
score = 0;
|
|
track_r2_score = 0;
|
|
}
|
|
//-------smart_brain_quiz_end------------
|
|
void million_instructions(){
|
|
printf("Possible answers are A,B,C & D\n");
|
|
printf("To use Fifty/Fifty Lifeline, Enter F\n");
|
|
printf("To ask a Friend for help, Enter P\n");
|
|
printf("To ask the Host for advice, Enter H\n");
|
|
}
|
|
|
|
void million_exit(int million_a){
|
|
printf("\nYou have come to the end of Who Wants To Be A Millionaire\n");
|
|
printf("\nYour Total Reward is %d\n",million_a);
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
int arr[11];
|
|
int p = 0;
|
|
for(int i = 0; i < 100; i++){
|
|
if(randArr[i] < 11){
|
|
arr[p] = randArr[i];
|
|
p++;
|
|
}
|
|
}
|
|
looping(questions, possible_options, answers, arr);
|
|
|
|
|
|
}
|
|
|
|
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 < 100; 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("\nPlaying who wants to be a millionaire...\n\n");
|
|
|
|
int million_i = 0, million_k = 0;;
|
|
char million_user_answers[round];
|
|
char million_std_answers[round] = {'B', 'C', 'D', 'C', 'B', 'D', 'B', 'A', 'B', 'B', 'A', 'D', 'C', 'C', 'B'};
|
|
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?",
|
|
"Which Disney character famously leaves a glass slipper behind at a royal ball?",
|
|
"What name is given to the revolving belt machinery in an airport that delivers checked luggage from the plane to baggage reclaim?",
|
|
"Which of these brands was chiefly associated with the manufacture of household locks?",
|
|
"The hammer and sickle is one of the most recognisable symbols of which political ideology?",
|
|
"Which toys have been marketed with the phrase “robots in disguise”?",
|
|
"What does the word loquacious mean?",
|
|
"Obstetrics is a branch of medicine particularly concerned with what?",
|
|
"In Doctor Who, what was the signature look of the fourth Doctor, as portrayed by Tom Baker?",
|
|
"Which of these religious observances lasts for the shortest period of time during the calendar year?",
|
|
"At the closest point, which island group is only 50 miles south-east of the coast of Florida?",
|
|
"Construction of which of these famous landmarks was completed first?",
|
|
"Which of these cetaceans is classified as a “toothed whale”?",
|
|
"Who is the only British politician to have held all four “Great Offices of State” at some point during their career?",
|
|
"In 1718, which pirate died in battle off the coast of what is now North Carolina?"
|
|
};
|
|
char answers[round][4][256] = {
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" },
|
|
{ "A) Pocahontas", "B) Sleeping Beauty", "C) Cinderella", "D) Elsa" },
|
|
{ "A) Hangar", "B) Terminal", "C) Concourse", "D) Carousel" },
|
|
{ "A) Phillips", "B) Flymo", "C) Chubb", "D) Ronseal" },
|
|
{ "A) Republicanism", "B) Communism", "C) Conservatism", "D) Liberalism" },
|
|
{ "A) Bratz Dolls", "B) Sylvanian Families", "C) Hatchimals", "D) Transformers" },
|
|
{ "A) Angry", "B) Chatty", "C) Beautiful", "D) Shy" },
|
|
{ "A) Childbirth", "B) Broken bones", "C) Heart conditions", "D) Old age" },
|
|
{ "A) Bow-tie, braces and tweed jacket", "B) Wide-brimmed hat and extra long scarf", "C) Pinstripe suit and trainers", "D) Cape, velvet jacket and frilly shirt" },
|
|
{ "A) Ramadan", "B) Diwali", "C) Lent", "D) Hanukkah" },
|
|
{ "A) Bahamas", "B) US Virgin Islands", "C) Turks and Caicos Islands", "D) Bermuda" },
|
|
{ "A) Empire State Building", "B) Royal Albert Hall", "C) Eiffel Tower", "D) Big Ben Clock Tower" },
|
|
{ "A) Gray whale", "B) Minke whale", "C) Sperm whale", "D) Humpback whale" },
|
|
{ "A) David Lloyd George", "B) Harold Wilson", "C) James Callaghan", "D) John Major" },
|
|
{ "A) Calico Jack", "B) Blackbeard", "C) Bartholomew Roberts", "D) Captain Kidd" }
|
|
};
|
|
|
|
million_instructions();
|
|
|
|
while(million_i < round && million_stay_in_game == 0){
|
|
|
|
printf("\nYou 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++;
|
|
}
|
|
million_exit(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\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(". Hello %s \n\n", name);
|
|
}
|
|
|
|
void B_username(void) {
|
|
char name[100] = {0};
|
|
printf("Please create a fun Username\n\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("How old are you?\n");
|
|
scanf("%s", info);
|
|
printf("\t\t You are old enough!!!\n\n");
|
|
}
|
|
|
|
void B_displayGameInstructions() {
|
|
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 and prizes 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\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\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n\n");
|
|
}
|
|
|
|
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\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is c.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round1(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
printf("Round 1 - Math\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: 6, 1, 3, 4\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "3") == 0) {
|
|
printf("Correct! You won a diamond.\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++;
|
|
} else {
|
|
printf("Incorrect. The answer is 3.\n\n");
|
|
}
|
|
|
|
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: 1, 2, 3, 4\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "2") == 0) {
|
|
printf("Correct! You won a triangle.\n\n");
|
|
int i, j;
|
|
for (i = 0; i < 5; i++) {
|
|
for (j = 0; j <= i; j++) {
|
|
printf("*");
|
|
}
|
|
printf("\n");
|
|
}
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is 2.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round2(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
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: Ture, False\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "False") == 0) {
|
|
printf("Correct! You won a star.\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++;
|
|
} else {
|
|
printf("Incorrect. The answer is False.\n\n");
|
|
}
|
|
|
|
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: True, False\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "True") == 0) {
|
|
printf("Correct! You won a Sword.\n\n");
|
|
printf(" /\\\n");
|
|
printf(" / \\\n");
|
|
printf(" / \\\n");
|
|
printf(" / \\\n");
|
|
printf(" /________\\\n");
|
|
printf(" | \n");
|
|
printf(" | \n");
|
|
printf(" | \n");
|
|
printf(" | \n");
|
|
printf(" | \n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is True.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round3(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
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: 5, 6, 7, 8\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "8") == 0) {
|
|
printf("Correct! You won a triangle.\n\n");
|
|
int i, j;
|
|
for (i = 0; i < 5; i++) {
|
|
for (j = 0; j <= i; j++) {
|
|
printf("*");
|
|
}
|
|
printf("\n");
|
|
}
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is 8.\n\n");
|
|
}
|
|
|
|
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: 206, 205, 207, 204\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "206") == 0) {
|
|
printf("Correct! You won a cat.\n\n");
|
|
printf(" /\\_/\\\n( o.o )\n > ^ < \n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is 206.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round4(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
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: Paris, London, Madrid, Berlin\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "Paris") == 0) {
|
|
printf("Correct! You won a Cow.\n\n");
|
|
printf(" \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||\n");
|
|
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is Paris.\n\n");
|
|
}
|
|
|
|
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! You won a stick man.\n\n");
|
|
printf(" o\n \\|/\n / \\\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round5(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
printf("Round 5\n\n");
|
|
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! You won a diamond.\n\n");
|
|
printf(" /\\\n ( )\n ( )\n ( )\n \\/\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is c.\n\n");
|
|
}
|
|
|
|
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! You won a sitting stick man.\n\n");
|
|
printf(" (o)\n /( )\\\n( )( )\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round6(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
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! You won a turtle shell.\n\n");
|
|
printf(" ___\n // \\\\\n(( ))\n \\ //\n ----\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is c.\n\n");
|
|
}
|
|
|
|
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! you won a dog.\n\n");
|
|
printf(" /\\_/\\\n( o.o )\n > ^ < \n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round7(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
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! You won a house.\n\n");
|
|
printf(" _____\n");
|
|
printf(" / \\\n");
|
|
printf(" /_______\\\n");
|
|
printf(" |[ ] [ ]|\n");
|
|
printf(" | = |\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is d.\n\n");
|
|
}
|
|
|
|
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! You won a tree.\n\n");
|
|
printf(" *\n");
|
|
printf(" ***\n");
|
|
printf(" *****\n");
|
|
printf(" *******\n");
|
|
printf(" *********\n");
|
|
printf(" ***********\n");
|
|
printf(" *****\n");
|
|
printf(" *****\n");
|
|
printf(" *****\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round8(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
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! You won an Emerald.\n\n");
|
|
printf(" /\\\n / \\ /\\\n / \\ / \\ \n/ \\ \\ \n\\ / / \n \\ / \\ / \n \\ /\\\n \\/\n");
|
|
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n\n");
|
|
}
|
|
|
|
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! You won a bird.\n\n");
|
|
printf(" /\\_/\\\n( o.o )\n > ^ < \n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is a.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round9(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
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: True, False\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "True") == 0) {
|
|
printf("Correct! You won a computer.\n\n");
|
|
printf(" ________________\n");
|
|
printf("| |\n");
|
|
printf("| |\n");
|
|
printf("| |\n");
|
|
printf("| |\n");
|
|
printf("|________________|\n");
|
|
printf(" __________\n");
|
|
printf(" | ________ |\n");
|
|
printf(" | | | |\n");
|
|
printf(" | |______| |\n");
|
|
printf(" |__________|\n");
|
|
score++;
|
|
} else {
|
|
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\n");
|
|
printf("Hint: The mode is a statistical measure that represents the most frequently occurring value in a dataset.\n\n");
|
|
printf("Options: True, False\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "True") == 0) {
|
|
printf("Correct! You won a tooth.\n\n");
|
|
printf(" ____________\n");
|
|
printf(" / \\\n");
|
|
printf(" / \\\n");
|
|
printf("(______________()\n");
|
|
printf(" \\ ___ /\n");
|
|
printf(" \\ / \\ /\n");
|
|
printf(" \\/ \\/\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is True.\n\n");
|
|
}
|
|
return score;
|
|
}
|
|
|
|
int B_round10(void) {
|
|
int score = 0;
|
|
char answer[20];
|
|
|
|
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: CO2, O2, H2O, N2O\n\n");
|
|
printf("Answer: ");
|
|
scanf("%s", answer);
|
|
|
|
if (strcmp(answer, "H2O") == 0) {
|
|
printf("Correct! You won a cool shape.\n");
|
|
printf(" ____\n / \\\n/________\\\n\\________/\n \\____/\n");
|
|
score++;
|
|
} else {
|
|
printf("Incorrect. The answer is H2O.\n\n");
|
|
}
|
|
|
|
printf("Question 2: Who developed the theory of relativity?\n\n");
|
|
printf("Hint: A German-born physicist.\n\n");
|
|
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! You won a rocket.\n\n");
|
|
printf(" /\\\n//\\\\\nV V\n");
|
|
score++;
|
|
} else {
|
|
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.\n\n\n");
|
|
}
|
|
|
|
void rate(void){
|
|
int rate;
|
|
printf("What would you rate my game out of 10?\n\n");
|
|
scanf("%d", &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)?\n\n ");
|
|
scanf(" %c", &response);
|
|
|
|
if (response == 'y') {
|
|
printf("Please write a one word review: (eg. amazing, cool, etc.)\n\n");
|
|
scanf("%s", review);
|
|
printf("Thank you for your review\n\n");
|
|
} else if (response == 'n') {
|
|
printf("Thank you for your time.\n\n");
|
|
} else {
|
|
printf("Invalid response.\n\n");
|
|
}
|
|
}
|
|
|
|
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();
|
|
total_score += B_round6();
|
|
total_score += B_round7();
|
|
total_score += B_round8();
|
|
total_score += B_round9();
|
|
total_score += B_round10();
|
|
printf("You scored %d out of 22.\n", total_score);
|
|
B_saythankyou();
|
|
rate();
|
|
B_write_review();
|
|
}
|
|
|
|
void v_play_rockpapersciss(){
|
|
int player_choice, computer_choice, player_score = 0, computer_score = 0;
|
|
srand(time(NULL));
|
|
|
|
printf("***************************\n");
|
|
printf("Playing Rock,Paper,Scissors!\n");
|
|
printf("***************************\n\n");
|
|
|
|
printf("First to win 3 rounds wins!\n\n");
|
|
|
|
while (1)
|
|
{
|
|
printf("Enter your choice:\n");
|
|
printf("1. Rock\n2. Paper\n3. Scissors\n\n");
|
|
printf("Your Choice:");
|
|
scanf("%d", &player_choice);
|
|
computer_choice = (rand() % 3) + 1;
|
|
if (player_choice == ROCK)
|
|
{
|
|
if (computer_choice == ROCK)
|
|
{
|
|
printf("\nTie! Both picked Rock\n\n");
|
|
}
|
|
else if (computer_choice == PAPER)
|
|
{
|
|
printf("\nYou lose! I picked Paper\n\n");
|
|
computer_score++;
|
|
printf("You have %d/3 points and I have %d/3 points.\n\n",player_score, computer_score);
|
|
}
|
|
else
|
|
{
|
|
printf("\nYou win! I picked Scissors\n\n");
|
|
player_score++;
|
|
printf("You have %d/3 points and I have %d/3 points.\n\n",player_score, computer_score);
|
|
}
|
|
}
|
|
else if (player_choice == PAPER)
|
|
{
|
|
if (computer_choice == ROCK)
|
|
{
|
|
printf("\nYou win! I picked Rock\n\n");
|
|
player_score++;
|
|
printf("You have %d/3 points and I have %d/3 points.\n\n",player_score, computer_score);
|
|
}
|
|
else if (computer_choice == PAPER)
|
|
{
|
|
printf("\nTie! Both picked Paper\n\n");
|
|
}
|
|
else
|
|
{
|
|
printf("\nYou lose! I picked Scissors\n\n");
|
|
computer_score++;
|
|
printf("You have %d/3 points and I have %d/3 points.\n\n",player_score, computer_score);
|
|
}
|
|
}
|
|
else if (player_choice == SCISSORS)
|
|
{
|
|
if (computer_choice == ROCK)
|
|
{
|
|
printf("\nYou lose! I picked Rock\n\n");
|
|
computer_score++;
|
|
printf("You have %d/3 points and I have %d/3 points.\n\n",player_score, computer_score);
|
|
}
|
|
else if (computer_choice == PAPER)
|
|
{
|
|
printf("\nYou win! I picked Paper\n\n");
|
|
player_score++;
|
|
printf("You have %d/3 points and I have %d/3 points.\n\n",player_score, computer_score);
|
|
}
|
|
else
|
|
{
|
|
printf("\nTie! Both picked Scissors\n\n");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
printf("\nInvalid choice!\n\n");
|
|
}
|
|
if (player_score == 3 || computer_score == 3)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
if (player_score == 3)
|
|
{
|
|
printf("You win the best of three!\n\n");
|
|
}
|
|
else
|
|
{
|
|
printf("I win the best of three!\n\n");
|
|
}
|
|
printf("******************************************\n");
|
|
printf("Thank you for playing Rock,Paper,Scissors!\n");
|
|
printf("******************************************\n\n");
|
|
}
|
|
|
|
|
|
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");
|
|
}
|
|
|
|
void progress_bar(int percentage)
|
|
{
|
|
printf("\r[");
|
|
for (int i = 0; i < 50; i++)
|
|
{
|
|
if (i < (percentage / 2))
|
|
{
|
|
printf(">");
|
|
}
|
|
else
|
|
{
|
|
printf(" ");
|
|
}
|
|
}
|
|
printf("] %d%%", percentage);
|
|
fflush(stdout);
|
|
}
|
|
|
|
void v_progress_bar(int argc, char *argv[]){
|
|
for (int i = 0; i <= 100; i++)
|
|
{
|
|
progress_bar(i);
|
|
usleep(100000);
|
|
}
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
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. Rock,Paper,Scissors!\n");
|
|
printf("9. Math Quiz\n");
|
|
printf("10. Exit\n");
|
|
printf("Enter your choice: ");
|
|
scanf("%d", &choice);
|
|
v_progress_bar(argc,argv);
|
|
|
|
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:
|
|
v_play_rockpapersciss();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 9:
|
|
math_display_choice();
|
|
jump_to_menu = 1;
|
|
break;
|
|
case 10:
|
|
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);
|
|
v_progress_bar(argc,argv);
|
|
}
|
|
}
|
|
feedbackForm();
|
|
displayCredits();
|
|
return 0;
|
|
}
|
|
|
|
|
|
|