On a given exam, the points awarded for each problem are recorded in a text file
ID: 3641861 • Letter: O
Question
On a given exam, the points awarded for each problem are recorded in a text file, with one line of the file for each student that took the exam. Create a program that reads this text file and determines• each student’s total grade for the exam
• the class average for the exam
• the average number of points given for each problem
Program Requirements
•The input data file will be a plain text file with each number separated by a single space.
•All numerical data (student ID, scores) must be stored in a 2-dimensional array.
oThe final column of the array should hold the total score for each student. Caution: do not include the student ID in the average!
oThe final should hold the averages for each column.
oThere will be 4 problems and 5 students, so the array should hold 6 rows (5 students + average) and 6 columns (ID, 4 grades, and exam total).
•All calculations and array access must be performed using pointers and dereferencing. You may use [ ] only when reading and writing the data files.
•The results must be printed to the screen as well as written to a file in table format.
Program Organization
Your program should contain the following functions: main, loadDataFile, calculateResults, writeResultsFile, and printResults.
•main – create empty 6x6 2-D array to hold data and then call other functions as needed, passing them the array
•loadDataFile – read the input file, storing the data in the 2-D array
•calculateResults – performs all calculations
•writeResultsFile – creates and writes the resulting array to the output data file
•printResults – prints the results to the screen
Example Input:
1 20 22 12 10
2 20 10 19 25
3 10 0 20 21
4 25 25 25 25
5 15 20 19 17
Example Output File
1 20 22 12 10 64
2 20 10 19 25 74
3 10 0 20 21 51
4 25 25 25 25 100
5 15 20 19 17 71
0 18 15.4 19 19.6 72