Write a program that reads input file “grades.txt” to EOF and inputs a 5 digit student ID number followed by 6 test grades then another 5 digit student ID number followed by another 6 test grades for up to 15 students. The grade data is to be loaded into a double two-dimensional array with 15 rows and 6 columns that would parallel an integer array storing the student ID numbers. The program then needs to produce the following output to a named “prog9_out_<YourNetID>.txt”. For each student: Student ID Number followed by the 6 test grades for each student. The test average for each student to the nearest whole number. (Use a function that has the grade array and row number as arguments and returns the test average for that student. This function should only perform this one task.)Example Prototype: double TestAverage(double[NO_GRADES], int )For each test: The class average for each test to the nearest whole number. (Use a function that has the grade array, number of actual students and test number as arguments and returns the class average for that test. This function should only perform this one task.) Example Prototype: double ClassAverage(double [NO_GRADES], int, int )
One additional required function: Use a function that has the grade array, ID number array and an integer passed by reference as its arguments. It should perform the task of reading the data from the input file into the arrays. The function should return the number of student records read from the file via an integer argument passed by reference. The return value of the function should be bool. It will return true if the input file is successfully opened and read; otherwise, it returns false. Example Prototype: bool GetData(double[NO_GRADES], int , int&) Array sizes should be implemented with global named constants.
Yes, I don't know why the word 'global' was used - unless a function is a member function in a class it is always global.
I suppose, to be pedantic, you might say that a function that was declared within a namespace wasn't truly "global". Particularly if it was declared in an anonymous namespace, to restrict it to the scope of a single translation unit.
Or, in old-fashioned C terms, if you declared a function as static, to restrict it to file scope, you wouldn't call that a "global function".
In any case, the tutor probably used the term in this assignment purely to emphasise the difference between a function and a method. I've been doing this for a long time, and I still get sloppy about calling a method a "function", so I'm sure it's even less obvious to a new student :D