|
@ -85,9 +85,11 @@ void math_choose_game() { |
|
|
if (choose == 'A'){ |
|
|
if (choose == 'A'){ |
|
|
math_display_choice(); |
|
|
math_display_choice(); |
|
|
final_score(); |
|
|
final_score(); |
|
|
|
|
|
score = 0; |
|
|
} else if(choose == 'B'){ |
|
|
} else if(choose == 'B'){ |
|
|
e_math_ques(); |
|
|
e_math_ques(); |
|
|
final_score(); |
|
|
final_score(); |
|
|
|
|
|
score = 0; |
|
|
} else { |
|
|
} else { |
|
|
goodbye_message(); |
|
|
goodbye_message(); |
|
|
} |
|
|
} |
|
@ -184,8 +186,8 @@ int math_answer(int num1) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void math_display_choice(){ |
|
|
void math_display_choice(){ |
|
|
int user_choice, user_answer,repeat = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int user_choice, user_answer,position = 0; |
|
|
|
|
|
bool repeat = true; |
|
|
printf("Choose a number between 1 and 4(game ends with invalid number or wrong answer): "); |
|
|
printf("Choose a number between 1 and 4(game ends with invalid number or wrong answer): "); |
|
|
scanf("%d", &user_choice); |
|
|
scanf("%d", &user_choice); |
|
|
user_choice = user_choice-1; |
|
|
user_choice = user_choice-1; |
|
@ -194,6 +196,8 @@ void math_display_choice(){ |
|
|
quiz_answer = math_answer(user_choice); |
|
|
quiz_answer = math_answer(user_choice); |
|
|
switch(user_choice){ |
|
|
switch(user_choice){ |
|
|
case 0: case 1: case 2: case 3: |
|
|
case 0: case 1: case 2: case 3: |
|
|
|
|
|
position++; |
|
|
|
|
|
printf("[%d]. ", position); |
|
|
math_choose_question(user_choice); |
|
|
math_choose_question(user_choice); |
|
|
printf("Answer: "); |
|
|
printf("Answer: "); |
|
|
scanf("%d", &user_answer); |
|
|
scanf("%d", &user_answer); |
|
@ -300,9 +304,10 @@ void e_math_print(char e_ques[][140], char e_poss[][140], char e_math_solution[] |
|
|
scanf(" %c", &user_answer); |
|
|
scanf(" %c", &user_answer); |
|
|
user_answer = toupper(user_answer); |
|
|
user_answer = toupper(user_answer); |
|
|
if (user_answer == e_math_solution[arr1]) { |
|
|
if (user_answer == e_math_solution[arr1]) { |
|
|
printf("Correct!\n"); |
|
|
|
|
|
|
|
|
score++; |
|
|
|
|
|
correct(score); |
|
|
} else { |
|
|
} else { |
|
|
printf("Wrong!\n"); |
|
|
|
|
|
|
|
|
wrong(score); |
|
|
printf("%s\n\n", e_math_statement[arr1]); |
|
|
printf("%s\n\n", e_math_statement[arr1]); |
|
|
} |
|
|
} |
|
|
i++; |
|
|
i++; |
|
@ -316,7 +321,7 @@ void math_enter_game() { |
|
|
printf("\t\t-------------------------------------------------------\n"); |
|
|
printf("\t\t-------------------------------------------------------\n"); |
|
|
printf("\t\t Please press 1 to enter Quiz-game \n "); |
|
|
printf("\t\t Please press 1 to enter Quiz-game \n "); |
|
|
printf("\t\t Please press 2 to see Instruction\n "); |
|
|
printf("\t\t Please press 2 to see Instruction\n "); |
|
|
printf("\t\t Please press 0 to Exit \n"); |
|
|
|
|
|
|
|
|
printf("\t\t Please press any key to Exit \n"); |
|
|
printf("\t\t-------------------------------------------------------\n\n"); |
|
|
printf("\t\t-------------------------------------------------------\n\n"); |
|
|
printf("Enter your choice: "); |
|
|
printf("Enter your choice: "); |
|
|
|
|
|
|
|
|