Documente Academic
Documente Profesional
Documente Cultură
// Assignment: pa6
//
// Description: Write a program with an EOF-control loop. The program will calculate the
average of each student,
// then the average of the whole class and print everything out on to the screen.
// Certification of Authenticity:
#include <iostream>
#include <fstream>
#include <iomanip>
int main()
// declare variable
ifstream inFile;
string name;
inFile.open("pa6.in");
if (inFile.fail())
return 0;
// output header
cout << setw(15) << "Name " << setw(10) << "Scores" << setw(16) << "Average" << endl;
counter = counter + 3;
cout << setw(15) << name << setw(5) << test1 << setw(5) << test2 << setw(5) << test3 <<
setw(8) << average << endl;
classAverage = sum/counter;
return 0;