diff --git a/src/main/quizproject.c b/src/main/quizproject.c index da9d3c3..31707d9 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -66,6 +66,10 @@ void e_usr_answr(char question[][100], char ans[], int initial, int end){ 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); @@ -76,17 +80,25 @@ void e_usr_answr(char question[][100], char ans[], int initial, int end){ 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++; + } } @@ -180,7 +192,11 @@ void e_printout_r3 (char question[][100], char answers[][100]) { 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------------ diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 95e865b..8a5936e 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -41,7 +41,7 @@ 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]); - +int track_r2_score = 0; //----smart_brain_header_end------- #define NUM_QUESTIONS 5