Browse Source

brain_whiz comparing of answers

main
parent
commit
818c9764fc
  1. 36
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

36
src/main/quizproject.c

@ -778,22 +778,42 @@ void math_question2(){
"[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"
};
for_loop_print_question(math_question, math_possible_answer);
char characters[] = {
'A',
'C',
'B',
'A',
'D',
'B',
'C',
'A',
'D',
'B'
};
for_loop_print_question(math_question, math_possible_answer, characters);
}
void compare_answer(char compare, char character1){
int counter = 0;
if (compare == character1) {
counter++;
printf("Right!, score is: %d\n", counter++);
} else {
printf("Wrong!\n");
}
void for_loop_print_question(char mathQuestions[][140], char mathPossible[][140]) {
for (int i = 1; i < 5; i++){
}
void for_loop_print_question(char mathQuestions[][140], char mathPossible[][140], char character[]) {
for (int i = 0; i < 5; i++){
char user_answer;
printf("[%d]. %s",i, mathQuestions[i]);
printf("%s", mathPossible[i]);
scanf(" %c", &user_answer);
if (user_answer == 'A') {
printf("Right!\n");
} else {
printf("Wrong!\n");
}
char character0 = character[i];
compare_answer(user_answer, character0);
}
}

3
src/main/quizproject.h

@ -140,8 +140,9 @@ void b_historyevents();
//-------brain_whiz_header_begin------------
void for_loop_print_question(char [][140], char [][140]);
void for_loop_print_question(char [][140], char [][140], char []);
void math_question2();
void compare_answer(char, char);
//-------brain_whiz_header_end-------------

Loading…
Cancel
Save