Browse Source

brain_whiz count scores

main
parent
commit
49776e8a94
  1. 65
      src/main/quizproject.c
  2. 2
      src/main/quizproject.h

65
src/main/quizproject.c

@ -801,7 +801,7 @@ void math_solution(char math_solutions[][10], int init1){
}
for(int i = 0; i < strlen(fact_answer); i++){
if (user_answer[i] == fact_answer[i]) {
if (tolower(user_answer[i]) == fact_answer[i]) {
k++;
}
}
@ -827,20 +827,16 @@ void math_fact_lie_print() {
printf("\t-------------------------------------------------------------------\n\n");
printf( "\t\t !! Wish you all the best !! \n\n");
printf("\t ......................................................\n" );
printf( "\n\nDo you still wish to continue playing ? If yes, then press 1. Else, press 0 : " );
int input1;
scanf("%d", &input1);
if(input1 == 1){
for(int i = 0; i < 8; i++){
switch (i) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
math_fact_lie(i);
printf("fact\\lie: ");
math_fact_lie_solutions(i);break;
}
}
} else {
goodbye_message();
}
}
@ -857,16 +853,16 @@ void math_question2(){
};
char math_possible_answer[][140] = {
"[A]. 2x + 7 [b]. x + 5 [c]. 6x + 5 [d]. x + 1",
"[A]. y = 4x + 0 [b]. 2x + 5 [c]. 2x + 0 [d]. 3x + 6",
"[A]. y = 2x + 2 [b]. 2x + 1 [c]. 5x + 8 [d]. 4x +6",
"[A].x = -7 or x = 3 [b]. x = 1 or x = 3 [c]. x = -3 or x = -7 [d]. x = 2 or x = 9",
"[A]. (3x - 2)(x - 2) [b]. (3x + 2)(x - 2) [c]. (6x - 3)(2x - 2) [d]. (3x - 1)(x + 2)",
"[A].y = 0.5x + 8.5 [b]. y = -0.5x + 4.5 [c]. y = 0.5x - 8.5 [d]. y = -0.5x - 8.5",
"[A].x = -2 [b]. x = 2 [c]. x = 7 [d]. x = -1",
"[A]. 10x + 10. [b]. 6x + 13 [c]. 3x + 7 [d]. 2x - 2",
"[A]. y = 7x - 1 [b]. y = 3x - 1 [c]. y = 3x + 3 [d]. y = 3x + 1",
"[A]. x = -2 [b]. x = 3 [c]. x = 5 [d]. x = 11"
"[a]. 2x + 7 [b]. x + 5 [c]. 6x + 5 [d]. x + 1",
"[a]. y = 4x + 0 [b]. 2x + 5 [c]. 2x + 0 [d]. 3x + 6",
"[a]. y = 2x + 2 [b]. 2x + 1 [c]. 5x + 8 [d]. 4x +6",
"[a].x = -7 or x = 3 [b]. x = 1 or x = 3 [c]. x = -3 or x = -7 [d]. x = 2 or x = 9",
"[a]. (3x - 2)(x - 2) [b]. (3x + 2)(x - 2) [c]. (6x - 3)(2x - 2) [d]. (3x - 1)(x + 2)",
"[a].y = 0.5x + 8.5 [b]. y = -0.5x + 4.5 [c]. y = 0.5x - 8.5 [d]. y = -0.5x - 8.5",
"[a].x = -2 [b]. x = 2 [c]. x = 7 [d]. x = -1",
"[a]. 10x + 10. [b]. 6x + 13 [c]. 3x + 7 [d]. 2x - 2",
"[a]. y = 7x - 1 [b]. y = 3x - 1 [c]. y = 3x + 3 [d]. y = 3x + 1",
"[a]. x = -2 [b]. x = 3 [c]. x = 5 [d]. x = 11"
};
char characters[] = {
@ -885,11 +881,9 @@ void math_question2(){
}
void compare_answer(char compare, char character1){
int counter = 0;
void compare_answer(char compare, char character1, int count){
if (compare == character1) {
counter++;
printf("Right!, score is: %d\n", counter++);
printf("Right!, score is: %d\n", count);
} else {
printf("Wrong!\n");
}
@ -904,31 +898,34 @@ void math_introduction(){
printf("\t-------------------------------------------------------------------\n\n");
printf( "\t\t !! Wish you all the best !! \n\n");
printf("\t ......................................................\n" );
printf( "\n\nDo you still wish to continue playing ? If yes, then press 1. Else, press 0 : " );
int input1;
scanf("%d", &input1);
if( input1 == 1 ){
math_question2();
} else{
goodbye_message();
}
}
void for_loop_print_question(char mathQuestions[][140], char mathPossible[][140], char character[]) {
int counter = 0;
for (int i = 0; i < 5; i++){
char user_answer;
printf("[%d]. %s",i, mathQuestions[i]);
printf("%s", mathPossible[i]);
printf("[%d]. %s",i+1, mathQuestions[i]);
printf("%s\n", mathPossible[i]);
scanf(" %c", &user_answer);
user_answer = toupper(user_answer);
char character0 = character[i];
compare_answer(user_answer, character0);
counter++;
compare_answer(user_answer, character0, counter);
}
}
void math_quiz_option(){
math_introduction();
printf( "\n\nDo you still wish to continue playing ? If yes, then press 1. Else, press 0 : " );
int input1;
scanf("%d", &input1);
if(input1 == 1){
math_question2();
math_fact_lie_print();
} else {
goodbye_message();
}
}
//-------brain_whiz_quiz_end--------------

2
src/main/quizproject.h

@ -142,7 +142,7 @@ void b_historyevents();
void for_loop_print_question(char [][140], char [][140], char []);
void math_question2();
void compare_answer(char, char);
void compare_answer(char, char, int);
void math_introduction();
void math_fact_lie(int);
void math_fact_lie_solutions(int);

Loading…
Cancel
Save