I am trying to find a way to find a median of individual parallel arrays, but I'm not sure how to start. One question I have, though....is an array the same as a list? I was told that it might be easier to do a bubble sort of a list, but I'm not sure how to turn my array into one...
here is my code:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cmath>
using namespace std;
double CalculateAvg (ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60],
int Q5[60], int Q6[60], int Final[60], int i);
double FindLargest(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
char calcGrade(double avgstore);
double Q1avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
double Q2avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
double Q3avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
double Q4avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
double Q5avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
double Q6avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
double MTavg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
double Favg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i);
void main()
{
ifstream students;
ofstream out;
string fname[60];
string studentid[60];
string lname[60];
string id[60];
int Q1[60];
int Q2[60];
int Q3[60];
int MidTerm[60];
int Q4[60];
int Q5[60];
int Q6[60];
int Final[60];
double avgstore;
string file;
int i;
cout << "Enter name of file" << endl;
cin >> file; file += ".txt";
students.open(file.c_str());
if(students)
{
out.open("CompleteReport.txt");
out << "Student Grade Report:" << endl;
cout << fixed << setprecision(1);
out << fixed << setprecision(1);
cout << endl
<< "StudentID LastName FirstName Q1 Q2 Q3 Mid Q4 Q5 Q6 Final Avg. Grade"
<< endl;
cout << "------------------------------------------------------------------------------------------------------------"
<<endl;
out << "StudentID LastName FirstName Q1 Q2 Q3 Mid Q4 Q5 Q6 Final Avg. Grade"
<< endl;
out << "-------------------------------------------------------------------------------------------------------------"
<<endl;
for (i = 0; i < 6; ++i )
{
if (students >> studentid[i] >> fname[i] >> lname[i] >> Q1[i] >> Q2[i] >> Q3[i] >> MidTerm[i]
>> Q4[i] >> Q5[i] >> Q6[i] >> Final[i])
{
cout << left << setw(13) << studentid[i] << setw(12) << fname[i] << setw(12) << lname[i] << setw(7)
<< Q1[i] << setw(7) << Q2[i] << setw(7) << Q3[i] << setw(7) << MidTerm[i] << setw(8)
<< Q4[i] << setw(7) << Q5[i] << setw(8) << Q6[i] << setw(8) << Final[i] << setw(10)<<
(avgstore = CalculateAvg (students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)) <<
setw(12) << calcGrade(avgstore);
out << left << setw(13) << studentid[i] << setw(12) << fname[i] << setw(8) << lname[i] << setw(7)
<< Q1[i] << setw(7) << Q2[i] << setw(7) << Q3[i] << setw(7) << MidTerm[i] << setw(8)
<< Q4[i] << setw(7) << Q5[i] << setw(8) << Q6[i] << setw(8) << Final[i] << setw(10)<<
(avgstore = CalculateAvg (students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)) <<
setw(12) << calcGrade(avgstore);
cout << endl;
}
else
{
break;
}
}
cout << "\n";
cout << "\t\t\t Average:" << " " << Q1avg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< " " << Q2avg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< " " << Q3avg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< " " << MTavg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< " " << Q4avg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< " " << Q5avg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< " " << Q6avg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< " " << Favg(students, id, fname, lname, Q1, Q2, Q3, MidTerm, Q4, Q5, Q6, Final, i)
<< endl;
students.close();
}
}
double CalculateAvg (ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double average1, average1a, average1b, average1c, average1d;
double average2, average2a, average2b, average2c, average2d;
double average3, average3a, average3b, average3c, average3d;
double average4, average4a, average4b, average4c, average4d;
double average5, average5a, average5b, average5c, average5d;
double average6, average6a, average6b, average6c, average6d;
double largest1, largest2, largest3, largest4, largest5, largest6;
largest1 = (Q1[i] * 2);
largest2 = (Q2[i] * 2);
largest3 = (Q3[i] * 2);
largest4 = (Q4[i] * 2);
largest5 = (Q5[i] * 2);
largest6 = (Q6[i] * 2);
average1 = ((largest2) + Q3[i] + (MidTerm[i] * 2) + Q4[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average1a = (Q2[i] + (largest3) + (MidTerm[i] * 2) + Q4[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average1b = (Q2[i] + Q3[i] + (MidTerm[i] * 2) + (largest4) + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average1c = (Q2[i] + Q3[i]+ (MidTerm[i] * 2) + Q4[i] + (largest5) + Q6[i] + (Final[i] * 3) )/ 12;
average1d = (Q2[i] + Q3[i] + (MidTerm[i] * 2) + Q4[i] + Q5[i] + (largest6) + (Final[i] * 3) )/ 12;
average2 = ((largest1) + Q3[i] + (MidTerm[i] * 2) + Q4[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average2a = (Q1[i] + (largest3) + (MidTerm[i] * 2) + Q4[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average2b = (Q1[i] + Q3[i] + (MidTerm[i] * 2) + (largest4) + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average2c = (Q1[i] + Q3[i] + (MidTerm[i] * 2) + Q4[i] + (largest5) + Q6[i] + (Final[i] * 3) )/ 12;
average2d = (Q1[i] + Q3[i] + (MidTerm[i] * 2) + Q4[i] + Q5[i] + (largest6) + (Final[i] * 3) )/ 12;
average3 = ((largest1) + Q2[i] + (MidTerm[i] * 2) + Q4[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average3a = (Q1[i] + (largest2) + (MidTerm[i] * 2) + Q4[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average3b = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + (largest4) + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average3c = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q4[i] + (largest5) + Q6[i] + (Final[i] * 3) )/ 12;
average3d = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q4[i] + Q5[i] + (largest6) + (Final[i] * 3) )/ 12;
average4 = ((largest1) + Q2[i] + (MidTerm[i] * 2) + Q3[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average4a = (Q1[i] + (largest2) + (MidTerm[i] * 2) + Q3[i] + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average4b = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + (largest3) + Q5[i] + Q6[i] + (Final[i] * 3) )/ 12;
average4c = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q3[i] + (largest5) + Q6[i] + (Final[i] * 3) )/ 12;
average4d = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q3[i] + Q5[i] + (largest6) + (Final[i] * 3) )/ 12;
average5 = ((largest1) + Q2[i] + (MidTerm[i] * 2) + Q3[i] + Q4[i] + Q6[i] + (Final[i] * 3) )/ 12;
average5a = (Q1[i] + (largest2) + (MidTerm[i] * 2) + Q3[i] + Q4[i] + Q6[i] + (Final[i] * 3) )/ 12;
average5b = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + (largest3) + Q4[i] + Q6[i] + (Final[i] * 3) )/ 12;
average5c = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q3[i] + (largest4) + Q6[i] + (Final[i] * 3) )/ 12;
average5d = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q3[i] + Q4[i] + (largest6) + (Final[i] * 3) )/ 12;
average6 = ((largest1) + Q2[i] + (MidTerm[i] * 2) + Q3[i] + Q4[i] + Q5[i] + (Final[i] * 3) )/ 12;
average6a = (Q1[i] + (largest2) + (MidTerm[i] * 2) + Q3[i] + Q4[i] + Q5[i] + (Final[i] * 3) )/ 12;
average6b = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + (largest3) + Q4[i] + Q5[i] + (Final[i] * 3) )/ 12;
average6c = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q3[i] + (largest4) + Q5[i] + (Final[i] * 3) )/ 12;
average6d = (Q1[i] + Q2[i] + (MidTerm[i] * 2) + Q3[i] + Q4[i] + (largest5) + (Final[i] * 3) )/ 12;
if ((Q1[i] <= Q2[i] && Q1[i] <= Q3[i] && Q1[i] <= Q4[i] && Q1[i] <= Q5[i] && Q1[i] <= Q6[i]) &&
(Q2[i] >= Q1[i] && Q2[i] >= Q3[i] && Q2[i] >= Q4[i] && Q2[i] >= Q5[i] && Q2[i] >= Q6[i]))
return average1;
else if ((Q1[i] <= Q2[i] && Q1[i] <= Q3[i] && Q1[i] <= Q4[i] && Q1[i] <= Q5[i] && Q1[i] <= Q6[i]) &&
(Q3[i] >= Q2[i] && Q3[i] >= Q1[i] && Q3[i] >= Q4[i] && Q3[i] >= Q5[i] && Q3[i] >= Q6[i]))
return average1a;
else if ((Q1[i] <= Q2[i] && Q1[i] <= Q3[i] && Q1[i] <= Q4[i] && Q1[i] <= Q5[i] && Q1[i] <= Q6[i]) &&
(Q4[i] >= Q1[i] && Q4[i] >= Q2[i] && Q4[i] >= Q3[i] && Q4[i] >= Q5[i] && Q4[i] >= Q6[i]))
return average1b;
else if ((Q1[i] <= Q2[i] && Q1[i] <= Q3[i] && Q1[i] <= Q4[i] && Q1[i] <= Q5[i] && Q1[i] <= Q6[i]) &&
(Q5[i] >= Q1[i] && Q5[i] >= Q2[i] && Q5[i] >= Q3[i] && Q5[i] >= Q4[i] && Q5[i] >= Q6[i]))
return average1c;
else if ((Q1[i] <= Q2[i] && Q1[i] <= Q3[i] && Q1[i] <= Q4[i] && Q1[i] <= Q5[i] && Q1[i] <= Q6[i]) &&
(Q6[i] >= Q1[i] && Q6[i] >= Q2[i] && Q6[i] >= Q3[i] && Q6[i] >= Q4[i] && Q6[i] >= Q5[i]))
return average1d;
else if ((Q2[i] <= Q1[i] && Q2[i] <= Q3[i] && Q2[i] <= Q4[i] && Q2[i] <= Q5[i] && Q2[i] <= Q6[i]) &&
(Q1[i] >= Q2[i] && Q1[i] >= Q3[i] && Q1[i] >= Q4[i] && Q1[i] >= Q5[i] && Q1[i] >= Q6[i]))
return average2;
else if ((Q2[i] <= Q1[i] && Q2[i] <= Q3[i] && Q2[i] <= Q4[i] && Q2[i] <= Q5[i] && Q2[i] <= Q6[i]) &&
(Q3[i] >= Q2[i] && Q3[i] >= Q1[i] && Q3[i] >= Q4[i] && Q3[i] >= Q5[i] && Q3[i] >= Q6[i]))
return average2a;
else if ((Q2[i] <= Q1[i] && Q2[i] <= Q3[i] && Q2[i] <= Q4[i] && Q2[i] <= Q5[i] && Q2[i] <= Q6[i]) &&
(Q4[i] >= Q1[i] && Q4[i] >= Q2[i] && Q4[i] >= Q3[i] && Q4[i] >= Q5[i] && Q4[i] >= Q6[i]))
return average2b;
else if ((Q2[i] <= Q1[i] && Q2[i] <= Q3[i] && Q2[i] <= Q4[i] && Q2[i] <= Q5[i] && Q2[i] <= Q6[i]) &&
(Q5[i] >= Q1[i] && Q5[i] >= Q2[i] && Q5[i] >= Q3[i] && Q5[i] >= Q4[i] && Q5[i] >= Q6[i]))
return average2c;
else if ((Q2[i] <= Q1[i] && Q2[i] <= Q3[i] && Q2[i] <= Q4[i] && Q2[i] <= Q5[i] && Q2[i] <= Q6[i]) &&
(Q6[i] >= Q1[i] && Q6[i] >= Q2[i] && Q6[i] >= Q3[i] && Q6[i] >= Q4[i] && Q6[i] >= Q5[i]))
return average2d;
else if ((Q3[i] <= Q1[i] && Q3[i] <= Q2[i] && Q3[i] <= Q4[i] && Q3[i] <= Q5[i])&&
(Q1[i] >= Q2[i] && Q1[i] >= Q3[i] && Q1[i] >= Q4[i] && Q1[i] >= Q5[i] && Q1[i] >= Q6[i]))
return average3;
else if ((Q3[i] <= Q1[i] && Q3[i] <= Q2[i] && Q3[i] <= Q4[i] && Q3[i] <= Q5[i])&&
(Q2[i] >= Q1[i] && Q2[i] >= Q3[i] && Q2[i] >= Q4[i] && Q2[i] >= Q5[i] && Q2[i] >= Q6[i]))
return average3a;
else if ((Q3[i] <= Q1[i] && Q3[i] <= Q2[i] && Q3[i] <= Q4[i] && Q3[i] <= Q5[i])&&
(Q4[i] >= Q1[i] && Q4[i] >= Q2[i] && Q4[i] >= Q3[i] && Q4[i] >= Q5[i] && Q4[i] >= Q6[i]))
return average3b;
else if ((Q3[i] <= Q1[i] && Q3[i] <= Q2[i] && Q3[i] <= Q4[i] && Q3[i] <= Q5[i])&&
(Q5[i] >= Q1[i] && Q5[i] >= Q2[i] && Q5[i] >= Q3[i] && Q5[i] >= Q4[i] && Q5[i] >= Q6[i]))
return average3c;
else if ((Q3[i] <= Q1[i] && Q3[i] <= Q2[i] && Q3[i] <= Q4[i] && Q3[i] <= Q5[i])&&
(Q6[i] >= Q1[i] && Q6[i] >= Q2[i] && Q6[i] >= Q3[i] && Q6[i] >= Q4[i] && Q6[i] >= Q5[i]))
return average3d;
else if ((Q4[i] <= Q1[i] && Q4[i] <= Q2[i] && Q4[i] <= Q3[i] && Q4[i] <= Q5[i] && Q4[i] <= Q6[i])&&
(Q1[i] >= Q2[i] && Q1[i] >= Q3[i] && Q1[i] >= Q4[i] && Q1[i] >= Q5[i] && Q1[i] >= Q6[i]))
return average4;
else if ((Q4[i] <= Q1[i] && Q4[i] <= Q2[i] && Q4[i] <= Q3[i] && Q4[i] <= Q5[i] && Q4[i] <= Q6[i])&&
(Q2[i] >= Q1[i] && Q2[i] >= Q3[i] && Q2[i] >= Q4[i] && Q2[i] >= Q5[i] && Q2[i] >= Q6[i]))
return average4a;
else if ((Q4[i] <= Q1[i] && Q4[i] <= Q2[i] && Q4[i] <= Q3[i] && Q4[i] <= Q5[i] && Q4[i] <= Q6[i])&&
(Q3[i] >= Q2[i] && Q3[i] >= Q1[i] && Q3[i] >= Q4[i] && Q3[i] >= Q5[i] && Q3[i] >= Q6[i]))
return average4b;
else if ((Q4[i] <= Q1[i] && Q4[i] <= Q2[i] && Q4[i] <= Q3[i] && Q4[i] <= Q5[i] && Q4[i] <= Q6[i])&&
(Q5[i] >= Q1[i] && Q5[i] >= Q2[i] && Q5[i] >= Q3[i] && Q5[i] >= Q4[i] && Q5[i] >= Q6[i]))
return average4c;
else if ((Q4[i] <= Q1[i] && Q4[i] <= Q2[i] && Q4[i] <= Q3[i] && Q4[i] <= Q5[i] && Q4[i] <= Q6[i])&&
(Q6[i] >= Q1[i] && Q6[i] >= Q2[i] && Q6[i] >= Q3[i] && Q6[i] >= Q4[i] && Q6[i] >= Q5[i]))
return average4d;
else if ((Q5[i] <= Q1[i] && Q5[i] <= Q2[i] && Q5[i] <= Q3[i] && Q5[i] <= Q4[i] && Q5[i] <= Q6[i])&&
(Q1[i] >= Q2[i] && Q1[i] >= Q3[i] && Q1[i] >= Q4[i] && Q1[i] >= Q5[i] && Q1[i] >= Q6[i]))
return average5;
else if ((Q5[i] <= Q1[i] && Q5[i] <= Q2[i] && Q5[i] <= Q3[i] && Q5[i] <= Q4[i] && Q5[i] <= Q6[i])&&
(Q2[i] >= Q1[i] && Q2[i] >= Q3[i] && Q2[i] >= Q4[i] && Q2[i] >= Q5[i] && Q2[i] >= Q6[i]))
return average5a;
else if ((Q5[i] <= Q1[i] && Q5[i] <= Q2[i] && Q5[i] <= Q3[i] && Q5[i] <= Q4[i] && Q5[i] <= Q6[i])&&
(Q3[i] >= Q2[i] && Q3[i] >= Q1[i] && Q3[i] >= Q4[i] && Q3[i] >= Q5[i] && Q3[i] >= Q6[i]))
return average5b;
else if ((Q5[i] <= Q1[i] && Q5[i] <= Q2[i] && Q5[i] <= Q3[i] && Q5[i] <= Q4[i] && Q5[i] <= Q6[i])&&
(Q4[i] >= Q1[i] && Q4[i] >= Q2[i] && Q4[i] >= Q3[i] && Q4[i] >= Q5[i] && Q4[i] >= Q6[i]))
return average5c;
else if ((Q5[i] <= Q1[i] && Q5[i] <= Q2[i] && Q5[i] <= Q3[i] && Q5[i] <= Q4[i] && Q5[i] <= Q6[i])&&
(Q6[i] >= Q1[i] && Q6[i] >= Q2[i] && Q6[i] >= Q3[i] && Q6[i] >= Q4[i] && Q6[i] >= Q5[i]))
return average5d;
else if ((Q6[i] <= Q1[i] && Q6[i] <= Q2[i] && Q6[i] <= Q3[i] && Q6[i] <= Q4[i] && Q6[i] <= Q5[i])&&
(Q1[i] >= Q2[i] && Q1[i] >= Q3[i] && Q1[i] >= Q4[i] && Q1[i] >= Q5[i] && Q1[i] >= Q6[i]))
return average6;
else if ((Q6[i] <= Q1[i] && Q6[i] <= Q2[i] && Q6[i] <= Q3[i] && Q6[i] <= Q4[i] && Q6[i] <= Q5[i])&&
(Q2[i] >= Q1[i] && Q2[i] >= Q3[i] && Q2[i] >= Q4[i] && Q2[i] >= Q5[i] && Q2[i] >= Q6[i]))
return average6a;
else if ((Q6[i] <= Q1[i] && Q6[i] <= Q2[i] && Q6[i] <= Q3[i] && Q6[i] <= Q4[i] && Q6[i] <= Q5[i])&&
(Q3[i] >= Q2[i] && Q3[i] >= Q1[i] && Q3[i] >= Q4[i] && Q3[i] >= Q5[i] && Q3[i] >= Q6[i]))
return average6b;
else if ((Q6[i] <= Q1[i] && Q6[i] <= Q2[i] && Q6[i] <= Q3[i] && Q6[i] <= Q4[i] && Q6[i] <= Q5[i])&&
(Q4[i] >= Q1[i] && Q4[i] >= Q2[i] && Q4[i] >= Q3[i] && Q4[i] >= Q5[i] && Q4[i] >= Q6[i]))
return average6c;
else if ((Q6[i] <= Q1[i] && Q6[i] <= Q2[i] && Q6[i] <= Q3[i] && Q6[i] <= Q4[i] && Q6[i] <= Q5[i])&&
(Q5[i] >= Q1[i] && Q5[i] >= Q2[i] && Q5[i] >= Q3[i] && Q5[i] >= Q4[i] && Q5[i] >= Q6[i]))
return average6d;
if (Q1[i] > Q2[i] && Q1[i] > Q3[i] && Q1[i] > Q4[i] && Q1[i] > Q5[i] && Q1[i] > Q6[i])
return largest1;
else if (Q2[i] > Q1[i] && Q2[i] > Q3[i] && Q2[i] > Q4[i] && Q2[i] > Q5[i] && Q2[i] > Q6[i])
return largest2;
else if (Q3[i] > Q2[i] && Q3[i] > Q1[i] && Q3[i] > Q4[i] && Q3[i] > Q5[i] && Q3[i] > Q6[i])
return largest3;
else if (Q4[i] > Q1[i] && Q4[i] > Q2[i] && Q4[i] > Q3[i] && Q4[i] > Q5[i] && Q4[i] > Q6[i])
return largest4;
else if (Q5[i] > Q1[i] && Q5[i] > Q2[i] && Q5[i] > Q3[i] && Q5[i] > Q4[i] && Q5[i] > Q6[i])
return largest5;
else if (Q6[i] > Q1[i] && Q6[i] > Q2[i] && Q6[i] > Q3[i] && Q6[i] > Q4[i] && Q6[i] > Q5[i])
return largest6;
else
return 0;
}
char calcGrade(double avgstore)
{
if (avgstore > 90)
return 'A';
else if (avgstore > 80)
return 'B';
else if (avgstore > 70)
return 'C';
else if (avgstore > 60)
return 'D';
else
return 'F';
}
double Q1avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum1,Q1average,cnt;
sum1 = 0.;
cnt = 0.;
for (int i=0; i<6; i++)
{
Q1[i]; sum1+=Q1[i];
cnt++;
}
Q1average = sum1/cnt;
return Q1average;
}
double Q2avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum,Q2average,cnt;
sum = 0.;
cnt = 0.;
for (int i=0; i<6; i++)
{
Q2[i]; sum+=Q2[i];
cnt++;
}
Q2average = sum/cnt;
return Q2average;
}
double Q3avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum1,Q3average,cnt;
sum1 = 0.;
cnt = 0.;
for (int i=0; i<6; i++)
{
Q3[i]; sum1+=Q3[i];
cnt++;
}
Q3average = sum1/cnt;
return Q3average;
}
double Q4avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum1,Q4average,cnt;
sum1 = 0.;
cnt = 0.;
for (int i=0; i<6; i++)
{
Q4[i]; sum1+=Q4[i];
cnt++;
}
Q4average = sum1/cnt;
return Q4average;
}
double Q5avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum1,Q5average, cnt;
sum1 = 0.;
cnt = 0.;
for (int i=0; i<6; i++)
{
Q5[i]; sum1+=Q5[i];
cnt++;
}
Q5average = sum1/cnt;
return Q5average;
}
double Q6avg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum1,Q6average, cnt;
sum1 = 0.;
cnt = 0.;
for (int i=0; i<6; i++)
{
Q6[i]; sum1+=Q6[i];
cnt++;
}
Q6average = sum1/cnt;
return Q6average;
}
double MTavg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum1,MTaverage, cnt;
sum1 = 0.;
cnt =0.;
for (int i=0; i<6; i++)
{
MidTerm[i]; sum1+=MidTerm[i];
cnt++;
}
MTaverage = sum1/cnt;
return MTaverage;
}
double Favg(ifstream& students, string studentid[60], string fname[60], string lname[60],
int Q1[60], int Q2[60], int Q3[60], int MidTerm[60], int Q4[60], int Q5[60],
int Q6[60], int Final[60],int i)
{
double sum1,Faverage, cnt;
sum1 = 0.;
cnt = 0.;
for (int i=0; i<6; i++)
{
Final[i]; sum1+=Final[i];
cnt++;
}
Faverage = sum1/cnt;
return Faverage;
}