#include<iostream>
#include<fstream>
usingnamespace std;
void InputOutput(char inputfile[100], char outputfile[100])
{
ifstream eds;
ofstream pds;
eds.open(inputfile);//opening input file
char first_Name[100], last_Name[100];
float grades = 0.0;
float max = 0.0;
float min = 0.0;
int count = 0;
float average = 0;
while (!eds.eof())
{
eds >> first_Name >> last_Name >> grades;
count++;
if (grades > max)
max = grades;
elseif (grades < min)
min = grades;
average += grades;
}
eds.close();
average /= count;
pds.open(outputfile);
pds << "The highest grade in the class is:" << max << endl;
pds << "The lowest grade in the class is: " << min << endl;
pds << "The class average is: " << average << endl;
cout << "The highest grade in the class is:" << max << endl;
cout << "The lowest grade in the class is: " << min << endl;
cout << "The class average is: " << average << endl;
pds.close();
}
int main()
{
char inputfile[100];
char outputfile[100];
cout << "Enter the input file: ";
cin >> inputfile;
cout << "Enter the ouput file: ";
cin >> outputfile;
InputOutput(inputfile, outputfile);
system("pause");
return 0;
}