Member Function getAverage

Member function processGrades next calls member function getAverage (line 45) to obtain the average of the grades. Member function getAverage (declared in line 23 of Fig. 7.15 and defined in lines 88–98 of Fig. 7.16) totals the values in array grades before calculating the average. The averaging calculation in line 97 uses grades.size() to determine the number of grades being averaged.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

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