The deadline for this lab is Wednesday 12 November 2008, xx:xx:xx hours. Strictly no submissions will be accepted after the deadline.
After scanning in student OCR forms, data is obtained in a “raw” format. Each line represents a student's matriculation number and his/her answers. We need to process this data and automatically mark each student's OCR form and present it in a human readable format.
53453214544141342235241214 NT081234X 0000 53413214554313345235141211 NT085703H 0000 53433214544135345235241214 U080001A 0000 53433514114124311215245221 U080002B 0000 55142514125335252535211224 U080003E 0000 54433224135341351534241524 U080005H 0000 53145524245111424324415224 U080007J 0000 43133524544111342235245114 U080009L 0000 55432214525531422235241111 U080010M 0000 33333314524441342534145113 U080011N 0000 35232434355553432333432124 U080012R 0000 53553212121543231235141214 U080014U 0000 53122144215123351133235224 U080016W 0000 55214222531433341224443142 U080017X 0000 45433114425313321233111353 U080018Y 0000 53423411525141352233242254 U080020Y 0000 15443344445321342235241213 U080021X 0000 53545344155341355514232314 U080023B 0000 53453214544141342235241214 U080025W 0000 45433514135141342211111514 U080028U 0000 55115543125535345545445134 U080030R 0000 55433214525121342535241214 U080033N 0000 51135542113515331513225314The first line in the text file consists of zero or more blank spaces followed by the answer key (also known as the correct answers to the test). So, the correct answer to question one is 5 (which means E), the correct answer to question 2 is 3 (which means C), and so on. You may assume that there are 26 questions in the test.
Subsequent lines consists of the student's matriculation number (which has at most nine characters), followed by one or more blank spaces, followed by four zeroes (ignore this data), followed by one or more blank spaces, and finally followed by the student's answers to the questions. You may assume that students will attempt every question.
Note that the number of lines in the text file is not known. You are to read the file until you reach the end of the text file.
Your task is to read in the answer key and all answers for all students, then mark each student's answers. Students get 1 mark for each correct answer, 0 marks otherwise. Print out the processed data on the screen in the following nice format, in the same order as the text file.
Take note of the following.
+-----------+----+-----------+-----------+-----------+-----------+-----------+---+ | NT081234X | 18 | E C D a C | B A D E e | D c a c C | D e B C E | a D A B A | a | | NT085703H | 22 | E C D c C | B A D E D | D A c e C | D e B C E | B D A B A | D | | U080001A | 14 | E C D c C | e A D a a | D A b d C | a a B a E | B D e B b | a | | U080002B | 10 | E e a d b | e A D a b | e c c e b | e B e C E | B a A B b | D | | U080003E | 13 | E d D c C | B b D a c | e c D A C | e a e C d | B D A e b | D | | U080005H | 8 | E C a d e | e b D b D | e A a A d | b d c b d | d a e B b | D | | U080007J | 18 | d C a c C | e b D E D | D A a A C | D B B C E | B D e a A | D | | U080009L | 15 | E e D c b | B A D E b | e e c A d | b B B C E | B D A a A | a | | U080010M | 14 | c C c c C | c A D E b | D d D A C | D B e C d | a D e a A | c | | U080011N | 4 | c e b c b | d c D c e | e e e c d | c B c C c | d c b a b | D | | U080012R | 15 | E C e E C | B A b a b | a e D c b | c a B C E | a D A B A | D | | U080014U | 9 | E C a b b | a d D b a | e A b c C | e a a C c | B c e B b | D | | U080016W | 7 | E e b a d | B b b E c | a d c c C | D a B b d | d D c a d | b | | U080017X | 8 | d e D c C | a A D d b | e c a c C | b a B C c | a a A c e | c | | U080018Y | 17 | E C D b C | d A a E b | e A D A C | e B B C c | B D b B e | D | | U080020Y | 16 | a e D d C | c d D d D | e c b A C | D B B C E | B D A B A | c | | U080021X | 9 | E C e d e | c d D a e | e c D A C | e e e a d | B c b c A | D | | U080023B | 26 | E C D E C | B A D E D | D A D A C | D B B C E | B D A B A | D | | U080025W | 14 | d e D c C | e A D a c | e A D A C | D B B a a | a a A e A | D | | U080028U | 6 | E e a a e | e d c a b | e e c e C | D e e d E | d D e a c | D | | U080030R | 20 | E e D c C | B A D E b | e A b A C | D B e C E | B D A B A | D | | U080033N | 5 | E a a c e | e d b a a | c e a e C | c a e a c | B b e c A | D | +-----------+----+-----------+-----------+-----------+-----------+-----------+---+
Remember to submit your program frequently using the submit testpro.c command, and check your submission using the check command.
All the best!