Browse Source

compare solution of fact_lie_math

main
parent
commit
dd04db7f79
  1. 28
      src/main/quizproject.c
  2. 1
      src/main/quizproject.h

28
src/main/quizproject.c

@ -780,11 +780,32 @@ void math_fact_lie(int question_num) {
printf("\n%s\n", math_facts_lies[question_num]); printf("\n%s\n", math_facts_lies[question_num]);
} }
void math_fact_lie_solutions(int solution_num) {
void math_fact_lie_solutions(int init) {
char math_fact_lie_solution [][10] = { char math_fact_lie_solution [][10] = {
"fact", "lie", "fact","lie","fact","fact","fact","lie","fact","fact","fact","lie","fact","lie","fact" "fact", "lie", "fact","lie","fact","fact","fact","lie","fact","fact","fact","lie","fact","lie","fact"
}; };
printf("%s", math_fact_lie_solution[solution_num]);
math_solution(math_fact_lie_solution,init);
}
void math_solution(char math_solutions[][10], int init1){
char user_answer[5], fact_answer[5];
int k = 0;
scanf("%s", user_answer);
for(int j = 0; j < 5; j++){
fact_answer[j] = math_solutions[init1][j];
}
for(int i = 0; i < strlen(fact_answer); i++){
if (user_answer[i] == fact_answer[i]) {
k++;
}
}
if(strlen(fact_answer) == k){
printf("right!\n");
}else {
printf("worng!\n");
}
} }
void math_fact_lie_print() { void math_fact_lie_print() {
@ -800,8 +821,7 @@ void math_fact_lie_print() {
switch (i) { switch (i) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
math_fact_lie(i); math_fact_lie(i);
char user_answer[5];
scanf("%s", user_answer);
math_fact_lie_solutions(i);break;
} }
} }

1
src/main/quizproject.h

@ -148,6 +148,7 @@ void math_fact_lie(int);
void math_fact_lie_solutions(int); void math_fact_lie_solutions(int);
void math_fact_lie_print(); void math_fact_lie_print();
void math_quiz_option(); void math_quiz_option();
void math_solution(char [][10], int);
//-------brain_whiz_header_end------------- //-------brain_whiz_header_end-------------

Loading…
Cancel
Save