|
@ -47,11 +47,12 @@ void e_display_instruction() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void e_usr_answr(char question[][100], char ans[], int initial, int end){ |
|
|
|
|
|
|
|
|
void e_usr_answr(char question[][100], char ans[], int initial, int end, int randChar[]){ |
|
|
int i; |
|
|
int i; |
|
|
char user_answer; |
|
|
char user_answer; |
|
|
for(i = initial; i < end; i++) { |
|
|
for(i = initial; i < end; i++) { |
|
|
printf("[%d]. %s", i + 1, question[i]); |
|
|
|
|
|
|
|
|
int rNum = randChar[i]; |
|
|
|
|
|
printf("[%d]. %s", i + 1, question[rNum]); |
|
|
scanf(" %c", &user_answer); |
|
|
scanf(" %c", &user_answer); |
|
|
user_answer = toupper(user_answer); |
|
|
user_answer = toupper(user_answer); |
|
|
while (user_answer != 'T' || user_answer != 'F' ){ |
|
|
while (user_answer != 'T' || user_answer != 'F' ){ |
|
@ -64,12 +65,12 @@ void e_usr_answr(char question[][100], char ans[], int initial, int end){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
bool ans1 = e_true_false(user_answer); |
|
|
bool ans1 = e_true_false(user_answer); |
|
|
if(ans1 == ans[i]) { |
|
|
|
|
|
|
|
|
if(ans1 == ans[rNum]) { |
|
|
score++; |
|
|
score++; |
|
|
track_r2_score++; |
|
|
|
|
|
if(track_r2_score >= 2) { |
|
|
|
|
|
track_r2_score = 0; |
|
|
|
|
|
|
|
|
if(i > 2) { |
|
|
|
|
|
track_r2_score++; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
correct(score); |
|
|
correct(score); |
|
|
} else{ |
|
|
} else{ |
|
|
wrong(score); |
|
|
wrong(score); |
|
@ -79,23 +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[]) { |
|
|
|
|
|
|
|
|
void e_t_f_printQuestions(char askquestion[][100],char answers[], int charArr[]) { |
|
|
int track_rounds = 0; |
|
|
int track_rounds = 0; |
|
|
while(track_rounds < 1){ |
|
|
while(track_rounds < 1){ |
|
|
printf("\t\t---------------------------Round1-----------------------------\n"); |
|
|
printf("\t\t---------------------------Round1-----------------------------\n"); |
|
|
printf("\t\t >>In this round you will be presented with 3 questions.<<\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"); |
|
|
printf("\t\t--------------------------------------------------------------\n\n"); |
|
|
int init = 0, end = 3; |
|
|
int init = 0, end = 3; |
|
|
e_usr_answr(askquestion,answers, init, end); |
|
|
|
|
|
|
|
|
e_usr_answr(askquestion,answers, init, end,charArr); |
|
|
|
|
|
|
|
|
if(score < 2) { |
|
|
if(score < 2) { |
|
|
break; |
|
|
break; |
|
|
} else { |
|
|
} else { |
|
|
printf("\t\t---------------------------Round2-----------------------------\n"); |
|
|
printf("\t\t---------------------------Round2-----------------------------\n"); |
|
|
printf("\t\t >>In this round you will be presented with 2 questions.<<\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"); |
|
|
printf("\t\t--------------------------------------------------------------\n\n"); |
|
|
init = 3, end = 5; |
|
|
init = 3, end = 5; |
|
|
e_usr_answr(askquestion,answers, init, end); |
|
|
|
|
|
|
|
|
e_usr_answr(askquestion,answers, init, end, charArr); |
|
|
} |
|
|
} |
|
|
track_rounds++; |
|
|
track_rounds++; |
|
|
} |
|
|
} |
|
@ -123,8 +126,16 @@ void e_ask_questions(void) { |
|
|
false |
|
|
false |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
e_t_f_printQuestions(e_t_f_question, e_t_f_solution); |
|
|
|
|
|
|
|
|
int* randChar = randomNumber(); |
|
|
|
|
|
int charArr[7]; |
|
|
|
|
|
int p1 = 0; |
|
|
|
|
|
for(int k = 0; k < 13; 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) { |
|
|
bool e_true_false(char choice) { |
|
@ -192,7 +203,7 @@ void e_printout_r3 (char question[][100], char answers[][100]) { |
|
|
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 ==0) { |
|
|
|
|
|
|
|
|
if(score >=4 && track_r2_score ==2) { |
|
|
e_questions_r3(); |
|
|
e_questions_r3(); |
|
|
} |
|
|
} |
|
|
score = 0; |
|
|
score = 0; |
|
@ -1013,7 +1024,7 @@ void b_entertostart() { |
|
|
void B_userinfo(void){ |
|
|
void B_userinfo(void){ |
|
|
char info[100] = {0}; |
|
|
char info[100] = {0}; |
|
|
printf("How old are you?\n"); |
|
|
printf("How old are you?\n"); |
|
|
scanf("%d", &info); |
|
|
|
|
|
|
|
|
scanf("%s", info); |
|
|
printf("\t\t Nice!!!\n\n"); |
|
|
printf("\t\t Nice!!!\n\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|