|
@ -30,13 +30,17 @@ int* randomNumber() { |
|
|
|
|
|
|
|
|
//------------Math_quiz_begin------------ |
|
|
//------------Math_quiz_begin------------ |
|
|
|
|
|
|
|
|
void math_help(){ |
|
|
|
|
|
printf( "\n\n Instructions that are supposed to be followed\n" ); |
|
|
|
|
|
printf("......................................................\n\n" ); |
|
|
|
|
|
printf( "As soon as you answer a question, you will be directed to the next question without any pause. " ); |
|
|
|
|
|
printf( "\n\n !! Wish you all the best !! \n\n " ); |
|
|
|
|
|
printf("......................................................\n" ); |
|
|
|
|
|
printf( "\n Do you still wish to continue playing ? If yes, then press 1. Else, press 0 : " ); |
|
|
|
|
|
|
|
|
void math_instruction(){ |
|
|
|
|
|
printf("\t\n\n------------------------Instructions-------------------------\n\n"); |
|
|
|
|
|
printf("\tThere are two Math Quiz Game. The first is Easy-Math and the second is Hard-Math\n"); |
|
|
|
|
|
printf("\tFor Easy-Math, you can choose a number between 1 and 5 to randomly generate a question.\n"); |
|
|
|
|
|
printf("\tA wrong answer means, you lose and you are out of the quiz Game.\n"); |
|
|
|
|
|
printf("\tIf you choose any other character or number apart from numbers between 1 and 5, you are out of the Game\n"); |
|
|
|
|
|
printf("\tIn the Hard-Math quiz, You are presented 10 questions\n\n"); |
|
|
|
|
|
printf("\t\n\n-------------------------------------------------\n\n"); |
|
|
|
|
|
printf( "\t\n\n !! Wish you all the best !! \n\n " ); |
|
|
|
|
|
printf("\t......................................................\n" ); |
|
|
|
|
|
printf( "\t\n Do you still wish to continue playing ? If yes, then press 1. Else, press 0 : " ); |
|
|
int input1; |
|
|
int input1; |
|
|
scanf("%d", &input1); |
|
|
scanf("%d", &input1); |
|
|
|
|
|
|
|
@ -254,7 +258,7 @@ void e_math_ques() { |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
char e_math_solution[11] = { |
|
|
|
|
|
|
|
|
char e_math_solution[10] = { |
|
|
'A', |
|
|
'A', |
|
|
'D', |
|
|
'D', |
|
|
'B', |
|
|
'B', |
|
@ -279,25 +283,36 @@ void e_math_ques() { |
|
|
"Solution: The equation of the circle is (x - 3)^2 + (y - 4)^2 = 25.", |
|
|
"Solution: The equation of the circle is (x - 3)^2 + (y - 4)^2 = 25.", |
|
|
"Solution: x = 6.", |
|
|
"Solution: x = 6.", |
|
|
}; |
|
|
}; |
|
|
e_math_print(e_math, e_math_possible, e_math_solution, e_math_statement); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int* randArr = randomNumber(); |
|
|
|
|
|
int arr[10]; |
|
|
|
|
|
int p = 0; |
|
|
|
|
|
for(int i = 0; i < 100; i++){ |
|
|
|
|
|
if(randArr[i] < 10){ |
|
|
|
|
|
arr[p] = randArr[i]; |
|
|
|
|
|
p++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
e_math_print(e_math, e_math_possible, e_math_solution, e_math_statement, arr); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void e_math_print(char e_ques[][140], char e_poss[][140], char e_math_solution[], char e_math_statement[][100]){ |
|
|
|
|
|
|
|
|
void e_math_print(char e_ques[][140], char e_poss[][140], char e_math_solution[], char e_math_statement[][100], int arr[]){ |
|
|
|
|
|
|
|
|
int i = 0; |
|
|
int i = 0; |
|
|
|
|
|
|
|
|
while(i < 10){ |
|
|
while(i < 10){ |
|
|
printf("[%d]. %s\n", i+1, e_ques[i]); |
|
|
|
|
|
printf(" %s\n",e_poss[i]); |
|
|
|
|
|
|
|
|
int arr1 = arr[i]; |
|
|
|
|
|
printf("[%d]. %s\n", i+1, e_ques[arr1]); |
|
|
|
|
|
printf(" %s\n",e_poss[arr1]); |
|
|
printf(" Answer: "); |
|
|
printf(" Answer: "); |
|
|
char user_answer; |
|
|
char user_answer; |
|
|
scanf(" %c", &user_answer); |
|
|
scanf(" %c", &user_answer); |
|
|
user_answer = toupper(user_answer); |
|
|
user_answer = toupper(user_answer); |
|
|
if (user_answer == e_math_solution[i]) { |
|
|
|
|
|
|
|
|
if (user_answer == e_math_solution[arr1]) { |
|
|
printf("Correct!\n"); |
|
|
printf("Correct!\n"); |
|
|
} else { |
|
|
} else { |
|
|
printf("Wrong!\n"); |
|
|
printf("Wrong!\n"); |
|
|
printf("%s\n\n", e_math_statement[i]); |
|
|
|
|
|
|
|
|
printf("%s\n\n", e_math_statement[arr1]); |
|
|
} |
|
|
} |
|
|
i++; |
|
|
i++; |
|
|
} |
|
|
} |
|
@ -321,7 +336,7 @@ void math_enter_game() { |
|
|
math_choose_game(); |
|
|
math_choose_game(); |
|
|
break; |
|
|
break; |
|
|
case 2: |
|
|
case 2: |
|
|
math_help(); |
|
|
|
|
|
|
|
|
math_instruction(); |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
printf("\t\t-------------------------------------------------------\n"); |
|
|
printf("\t\t-------------------------------------------------------\n"); |
|
|