//Nicolas Ruano CS1A Chapter 3 Pp. 142 #3
/*******************************************************************************
* CALCULATING TEST AVERAGES
* ____________________________________________________________________________
* We gather all test scores being provided and we have to find the average
* score on at least one decimal
* ____________________________________________________________________________
* Score 1 = 85
* Score 2 = 92
* Score 3 = 78
* Score 4 = 88
* Score 5 = 91
* ___________________________________________________________________________
* Add all the result togehter to get a full number, then we divide out by 5 to
* get the average result.
*
* SPECIAL NOTE: Behold, a perfect example of how do you calculate score by
* first adding all of results together and then dividing the added result by
* five to get the whole grade average.
*******************************************************************************/
#include <iostream>
#include <iomanip> // for std::fixed and std::setprecision
int main() {
double score1, score2, score3, score4, score5;
double total, average;
// Ask for 5 test scores
std::cout << "Enter the first test score: 85\n";
std::cin >> score1;
std::cout << "Enter the second test score: 92\n";
std::cin >> score2;
std::cout << "Enter the third test score: 78\n";
std::cin >> score3;
std::cout << "Enter the fourth test score: 88\n";
std::cin >> score4;
std::cout << "Enter the fifth test score: 91\n";
std::cin >> score5;
// Calculate total and average
total = score1 + score2 + score3 + score4 + score5;
average = total / 5.0;
// Display average with 1 decimal place
std::cout << std::fixed << std::setprecision(1);
std::cout << "The average score is: 86.6" << average << std::endl;
return 0;
}