CS13002 Programming and Data Structures
Section: 4/D, Spring 2005
This exercise is based on one-dimensional arrays and sorting. You are given a list of students of the Foobarnautic Engineering students that took the PDS course last year. Their roll numbers and letter grades are listed in this file.
- Read the file and store in two arrays the roll numbers and the corresponding letter grades. Since each roll number of this department starts with "03FB13", it is sufficient to store only the last two digits of each roll number as an int. Letter grades are to be stored in an array of char's. The grade EX is to be stored as X.
- Write a function to print the list of roll number-grade pairs sorted with respect to the roll number.
- Write a function to print the list of roll number-grade pairs sorted first with respect to the grade and then with respect to the roll number. Note that grades are sorted with respect to the order EX-A-B-C-D-P-F. This is different from the regular dictionary order.
Both the functions should take the two arrays as parameters and must not change the locations in these arrays. You may use temporary arrays inside the functions. You may use any sorting algorithm you like.
DO NOT USE STRUCTURES ANYWHERE IN YOUR CODE.
Report the output of your program on the database stored in this file.
Sample outputConsider the following raw data on a class of 20 students:03FB1316 X 03FB1320 A 03FB1312 B 03FB1317 B 03FB1309 X 03FB1305 B 03FB1311 B 03FB1313 B 03FB1314 P 03FB1319 B 03FB1307 D 03FB1315 C 03FB1304 B 03FB1301 B 03FB1308 C 03FB1306 F 03FB1303 B 03FB1318 B 03FB1310 B 03FB1302 B
For this grade distribution, your output should look like:The sorted list with respect to roll numbers is: 03FB1301 B 03FB1302 B 03FB1303 B 03FB1304 B 03FB1305 B 03FB1306 F 03FB1307 D 03FB1308 C 03FB1309 EX 03FB1310 B 03FB1311 B 03FB1312 B 03FB1313 B 03FB1314 P 03FB1315 C 03FB1316 EX 03FB1317 B 03FB1318 B 03FB1319 B 03FB1320 A The sorted list with respect to grades is: 03FB1309 EX 03FB1316 EX 03FB1320 A 03FB1301 B 03FB1302 B 03FB1303 B 03FB1304 B 03FB1305 B 03FB1310 B 03FB1311 B 03FB1312 B 03FB1313 B 03FB1317 B 03FB1318 B 03FB1319 B 03FB1308 C 03FB1315 C 03FB1307 D 03FB1314 P 03FB1306 F