diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 80512f0..f42d885 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -123,11 +123,64 @@ bool e_true_false(char choice) { } 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(); + e_questions_r3(); } //-------smart_brain_quiz_end------------ diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 625e0d0..95e865b 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -39,6 +39,8 @@ void e_ask_questions(void); void e_smart_brain(void); bool e_true_false(char); void e_usr_answr(char [][100], char [], int, int); +void e_questions_r3(void); +void e_printout_r3 (char [][100], char [][100]); //----smart_brain_header_end-------