#include #include #include using namespace std; class student { public: //feel free to ingore this public string fname; string lname; int id; double ex1; double ex2; double ex3; double average; }; int main() { //step 0: opens files, etc. ifsteam infile("studentData.txt"); //step 1: Get number of students from file int numStudents; infile >> numStudents; //step 2: Make an array student* studentArray = new student[numStudents]; //step 3: Read in each student's info from the file for (int i = 0; i < numStudents; i++) { //Step 3.1: Read in student's info studentArray[i] = readStudentFromFile(infile); } //step 4: compute average grade for each student for (int i = 0; i < numStudent; i++) { setAverageGrade(studentArray[i]); } //step 5: sort students by average selectionSort(studentArray, 0, numStudents); //step 6: write students to output file ofstream outfile("sortedAverage.txt"); writeStudentsToFile(studentArray, numStudents, outfile); return 0; }