1 2 3
|
char answers[SIZE] = {'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B',
'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A'};
char student[SIZE];
|
is "student" used to collect the student's answers? You are sending "answers" into the function that collects the student's answers, but you never send in "student". You're just overwriting "answers" every time. "student" doesn't have any initial value, so it's extremely unlucky that whatever junk value was in that memory location matches the answer key.
When I made the suggested change, I get this:
Driver's License Program Exam GradesUSING ONLY CAPITAL A, B, C, or D AS ANSWERS
Enter answer for question 1:
BDAACABACDBCDADCCBDA
Enter answer for question 2:
Enter answer for question 3:
Enter answer for question 4:
Enter answer for question 5:
Enter answer for question 6:
Enter answer for question 7:
Enter answer for question 8:
Enter answer for question 9:
Enter answer for question 10:
Enter answer for question 11:
Enter answer for question 12:
Enter answer for question 13:
Enter answer for question 14:
Enter answer for question 15:
Enter answer for question 16:
Enter answer for question 17:
Enter answer for question 18:
Enter answer for question 19:
Enter answer for question 20:
Student got 20 right.
Student got 0 wrong.
Student passed.
Press any key to continue . . .