Browse Source

smart_brain: added round 4

main
parent
commit
64af13af15
  1. 102
      src/main/quizproject.c
  2. 2
      src/main/quizproject.h

102
src/main/quizproject.c

@ -39,7 +39,8 @@ void e_display_instruction() {
printf("\t\t-------------------------------------------------------\n"); printf("\t\t-------------------------------------------------------\n");
printf("\t\t To start this Quiz, here are the instructions\n"); printf("\t\t To start this Quiz, here are the instructions\n");
printf("\t\t------------------------------------------------------\n\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-------------------------------------------------------\n\n");
printf("\t\t>>Press any key and enter to begin the Quiz.<<\n\n"); printf("\t\t>>Press any key and enter to begin the Quiz.<<\n\n");
e_press_key_start(); 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() { void e_smart_brain() {
e_display_instruction(); e_display_instruction();
e_ask_questions(); e_ask_questions();
if(score >=4 && track_r2_score ==2) { if(score >=4 && track_r2_score ==2) {
e_questions_r3(); e_questions_r3();
} }
guess_word_questions();
score = 0; score = 0;
track_r2_score = 0; track_r2_score = 0;
} }
//-------smart_brain_quiz_end------------
void million_instructions(){ void million_instructions(){
printf("Possible answers are A,B,C & D\n"); printf("Possible answers are A,B,C & D\n");
printf("To use Fifty/Fifty Lifeline, Enter F\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); printf("\nYour Total Reward is %d\n",million_a);
} }
//-------smart_brain_quiz_end------------
void displayWelcomeMessage(void) { void displayWelcomeMessage(void) {
displayGameInstructions(); displayGameInstructions();

2
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_questions_r3(void);
void e_printout_r3 (char [][100], char [][100]); void e_printout_r3 (char [][100], char [][100]);
int track_r2_score = 0; 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------- //----smart_brain_header_end-------
//Epic Game Headers //Epic Game Headers

Loading…
Cancel
Save