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);
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)) <<

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)) <<

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;
}

{
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;
}``````

An array and a list are two different things. Its a lot easier to sort an array than linked list.

An array and a list are two different things. Its a lot easier to sort an array than linked list.

Depends of the definition of "easier" and relative to whom :

``````int A[4] = {4,5,-1,2};
list<int> B(A,A+5);

std::sort(A,A+5); //sort array
list.sort(); //sort list``````

@OP : I think you need to rethink your code (if you have time).

You are hardcoding it way too much. It makes it hard for us to help you.

For example you are doing a lot of :

``if (students >> studentid[i] >> fname[i] >> lname[i] >> Q1[i] >> Q2[i] >> Q3[i] >> MidTerm[i]  ...``

By making it into a loop, you code would be about 50 percent shorter
and more understandable.

What do you think?

@OP : I think you need to rethink your code (if you have time).

You are hardcoding it way too much. It makes it hard for us to help you.

For example you are doing a lot of :

``if (students >> studentid[i] >> fname[i] >> lname[i] >> Q1[i] >> Q2[i] >> Q3[i] >> MidTerm[i]  ...``

By making it into a loop, you code would be about 50 percent shorter
and more understandable.

What do you think?

I want to roll with code as I have it now, since I have a week to get this done. I want to make sure that I can get one set of codes working first, then try to clean it up if I have time.

Any ideas on how I should try to create my Median function?

Which array to you want to find the median of? Since you want to make it very difficult for yourself, sort all eight arrays at the same time, using only one of the for testing purposes. What a swap is needed you will have to swap all eight arrays so that they are kept in order. That should have been a lot easier had you used a structure to hold all the information for one person. But since you didn't, you will just have the bite the bullet and do it the difficult way.

wow..it's huge..!@#..i'm sorry..

Which array to you want to find the median of? Since you want to make it very difficult for yourself, sort all eight arrays at the same time, using only one of the for testing purposes. What a swap is needed you will have to swap all eight arrays so that they are kept in order. That should have been a lot easier had you used a structure to hold all the information for one person. But since you didn't, you will just have the bite the bullet and do it the difficult way.

Instead of berating me, why not teach me how to do it properly? I've tried hard on this code, and I apologize that I'm not up to your standards, but it would still be great if you could pass your infinite knowledge on to the lowest of lowly students :P

Well, you still failed to answer my question. I made a valid suggestion in the first three sentences. Now its up to you to take it or leave it -- your choice.

>>it would still be great if you could pass your infinite knowledge on to the lowest of lowly students
I would be happy to do that -- but first you have to answer my questions. I'm not a mind reader.

Well, you still failed to answer my question. I made a valid suggestion in the first three sentences. Now its up to you to take it or leave it -- your choice.

>>it would still be great if you could pass your infinite knowledge on to the lowest of lowly students
I would be happy to do that -- but first you have to answer my questions. I'm not a mind reader.

I'll take it! I'm trying to find the median of all the Q's (i.e. Q1, Q2, etc.), since I have them in parallel arrays. I understand that a structure would make it easier, I just 1). haven't covered it yet, and 2). want to make sure that I at least have a working code to turn in before delving into something new.....

First create an temporary array to hold the values

``````int array[] = {Q1[0], Q2[0], Q3[0], Q4[0], Q5[0], Q6[0], Q7[0], Q8[0]};
// now for the array
for(int i = 0; i < 7; i++)
{
for(int j = i+1; j < 8; j++)
{
if( array[i] > array[j] )
{
int temp = array[i];
array[i] = array[j];
array[j]= temp;
}
}
}
// now the median is the middle value of array
int median = array[4];``````

Once you get the above compiled and working, make a function out of it so that the function can be called for each row in the Q arrays.

``````int median(int Q1, int Q2, int Q3, int Q4, int Q5, int Q6, int Q7, int Q8)
{
// calculate and return the median of the parameters
}

int main()
{
int Q1[8], Q2[8], Q3[8] ... Q8[8];

for(int i = 0; i < 8; i++)
{
int m = median( Q1[i], Q2[i], ... Q8[i]);
}
}``````
commented: Appreciate that you are helping this one. +2

First create an temporary array to hold the values

``````int array[] = {Q1[0], Q2[0], Q3[0], Q4[0], Q5[0], Q6[0], Q7[0], Q8[0]};
// now for the array
for(int i = 0; i < 7; i++)
{
for(int j = i+1; j < 8; j++)
{
if( array[i] > array[j] )
{
int temp = array[i];
array[i] = array[j];
array[j]= temp;
}
}
}
// now the median is the middle value of array
int median = array[4];``````

Once you get the above compiled and working, make a function out of it so that the function can be called for each row in the Q arrays.

``````int median(int Q1, int Q2, int Q3, int Q4, int Q5, int Q6, int Q7, int Q8)
{
// calculate and return the median of the parameters
}

int main()
{
int Q1[8], Q2[8], Q3[8] ... Q8[8];

for(int i = 0; i < 8; i++)
{
int m = median( Q1[i], Q2[i], ... Q8[i]);
}
}``````

how would I print the values of the array out?

would it be:

``````int store(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)
{
int median;
int array[]={Q1[i],Q2[i],Q3[i],MidTerm[i],Q4[i],Q5[i],Q6[i],Final[i]};

for(int i = 0; i < 7; i++)
{
for(int j = i+1; j < 8; j++)
{
if( Q1[i] > Q1[j] )
{
int temp = Q1[i];
Q1[i] = Q1[j];
Q1[j]= temp;
}
}
}
median = Q1[4];
return median;
}``````

and then in my void main()

``cout << store (id, fname, lname, .....etc);``

since I'm trying to find the median of a vertical column....however the result that comes out is 65, when the mathematical median is actually 70.5...