... of the grades array
135      void outputGrades() const {
136         std::cout << "\nThe grades are:\n\n";
137         std::cout << "            "; // align column heads
138
139         // create a column heading for each of the tests
140         for (size_t test{0}; test < tests; ++test) {
141            std::cout << "Test " << test + 1 << "  ";
142         }
143
144         std::cout << "Average" << std::endl;
145
146         // create rows/columns of text representing array grades
147         for (size_t student{0}; student < grades.size(); ++student) {
148            std::cout << "Student " << std::setw(2) << student + 1;
149
150            // output student's grades
151            for (size_t test{0}; test < grades[student].size(); ++test) {
152               std::cout << std::setw(8) << grades[student][test];
153            }
154
155            // call member function getAverage to calculate student's ...

Get C++ How to Program, 10/e now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.