I was given a task, it's nothing special but I did hit the wall here...
After getting arithmetical means I need to compare them and output the highest and the lowest ones.
The x is a student number, the vid[] is the arithmetical mean.
For example:
Student number x has arithmetical mean vid[i]
and the task wants me to output which student has the highest and which one has the lowest means.
The worst part that I can't use stuff like max() and min() because I don't know how many students are there in total. Plus they are all arrays which have the same variable name vid[].
Any help would be appreciated =)
int main()
{
int mokSK=0, p1[25], p2[25], p3[25], x[25], vid[25], iv=0;
ifstream inFile("inFile.in");
ofstream outFile("outFile.out");
inFile >> mokSK;
for(int i=0;i<mokSK;i++)
{
inFile >> x[i] >> p1[i] >> p2[i] >> p3[i];
vid[i]=(p1[i]+p2[i]+p3[i])/3;
outFile<< x[i] <<" " << vid[i] << endl;
}
return 0;
}