From 64af13af15543b0d9b97c4263427b8fbf1284cf0 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Fri, 3 Feb 2023 11:26:50 +0000 Subject: [PATCH] smart_brain: added round 4 --- src/main/quizproject.c | 102 +++++++++++++++++++++++++++++++++++++++-- src/main/quizproject.h | 2 + 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index b7fb5bb..1c256b0 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -39,7 +39,8 @@ 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>>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(); @@ -200,16 +201,111 @@ void e_printout_r3 (char question[][100], char answers[][100]) { } } +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" + }; + + char guess_solution [][100] = { + "nihe", + "uct", + "hycs", + "wscin", + "ednc", + "veopnt", + "ebst", + "esienc", + "tlen", + "parmenr", + "oateie", + "gninc" + }; + + char word_guessed[][100] = { + "finished", + "bucket", + "physics", + "wisconsin", + "evidence", + "development", + "website", + "residence", + "settlement", + "Parliamentary", + "monasteries", + "significance" + }; + + print_guess_word_question (guess_words, guess_solution,word_guessed); +} + + +void print_guess_word_question (char guessWord[][100], char guessSolution[][100],char guessedWord[][100]){ + + 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 ++) { + char usr_ans[100]; + int k = 0; + printf("[%d]. Guess the word by finding the missing Letters:\n %s: \n",j+1, guessWord[j]); + printf(" Your answer: "); + scanf("%s",usr_ans); + + char arr[30]; + for(int p = 0; p < 30; p++) { + arr[p] = guessSolution[j][p]; + + if (guessSolution[j][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[j]); + } else { + printf("Wrong!\nYou have %d points\n", score); + } + + } +} + void e_smart_brain() { e_display_instruction(); e_ask_questions(); if(score >=4 && track_r2_score ==2) { e_questions_r3(); } + guess_word_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"); @@ -222,7 +318,7 @@ void million_exit(int million_a){ printf("\nYour Total Reward is %d\n",million_a); } -//-------smart_brain_quiz_end------------ + void displayWelcomeMessage(void) { displayGameInstructions(); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 6a82bed..4570183 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -45,6 +45,8 @@ void e_usr_answr(char [][100], char [], int, int,int []); void e_questions_r3(void); void e_printout_r3 (char [][100], char [][100]); int track_r2_score = 0; +void guess_word_questions(void); +void print_guess_word_question (char [][100], char [][100],char [][100]); //----smart_brain_header_end------- //Epic Game Headers