Implementing Sentinel-Controlled Repetition in Class GradeBook
Figures 4.9–4.10 show class
GradeBook containing member function
determineClassAverage (this class is demonstrated in Fig. 4.11). Although each grade entered is an integer, the averaging calculation is likely to produce a number with a decimal point—in other words, a real number or floating-point number (e.g., 7.33, 0.0975 or 1000.12345). C++ provides several data types for storing floating-point numbers in memory, including float and double. The primary difference between these types is that, compared to
double variables can typically store numbers with larger magnitude and finer detail (i.e., more digits to the right of the decimal point—also known as the number’s ...