// Cenyao Huang CS1A Chapter 3, P. 143, #3
/************************************************************************
* COMPUTE TEST AVERAGE
* This program computes the average score of five tests.
*
* This program uses the formula:
* averageScore = (score1 + score2 + score3 + score4 + score5)/5
*
* Input
* score1 : the score of the first test
* score2 : the score of the second test
* score3 : the score of the third test
* score4 : the score of the fourth test
* score5 : the score of the fifth test
*
* Output
* averageScore : the average score of five tests
*
************************************************************************/
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main() {
float score1, score2, score3, score4, score5, average; // assign data type to variable
cout << "Please provide five test scores: " << endl; // prompt to enter in data
cin >> score1 >> score2 >> score3 >> score4 >> score5; // reads scores from keyboard
average = (score1 + score2 + score3 + score4 + score5)/5; // calculates average
cout << "the average is: " << fixed << setprecision(1) << average << endl; // displays average
return 0;
}
Ly8gQ2VueWFvIEh1YW5nICAgICAgICAgICAgICAgICAgQ1MxQSAgICAgICAgICAgICAgIENoYXB0ZXIgMywgUC4gMTQzLCAjMwoKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqIENPTVBVVEUgVEVTVCBBVkVSQUdFCiogVGhpcyBwcm9ncmFtIGNvbXB1dGVzIHRoZSBhdmVyYWdlIHNjb3JlIG9mIGZpdmUgdGVzdHMuCioKKiBUaGlzIHByb2dyYW0gdXNlcyB0aGUgZm9ybXVsYToKKiBhdmVyYWdlU2NvcmUgPSAoc2NvcmUxICsgc2NvcmUyICsgc2NvcmUzICsgc2NvcmU0ICsgc2NvcmU1KS81CioKKiBJbnB1dAoqIHNjb3JlMSA6IHRoZSBzY29yZSBvZiB0aGUgZmlyc3QgdGVzdAoqIHNjb3JlMiA6IHRoZSBzY29yZSBvZiB0aGUgc2Vjb25kIHRlc3QKKiBzY29yZTMgOiB0aGUgc2NvcmUgb2YgdGhlIHRoaXJkIHRlc3QKKiBzY29yZTQgOiB0aGUgc2NvcmUgb2YgdGhlIGZvdXJ0aCB0ZXN0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