... 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.