/*************************************************
* TMA02, q3b.cpp
* Take in an array of 5 scores and returns the
* best 4's average score.
* Programming by Allen Lam (99043953)
* Dec 2000
*************************************************/
float evaluateOCAS(int tmaScores[]){
int i, min, total=0;
/* Find out the lowest score, store in min */
min = tmaScores[0];
for (i=1; i<5; i++)
if (tmaScores[i]<min) min = tmaScores[i];
/* sum of all five scores, store in total */
for (i=0; i<5; i++) total += tmaScores[i];
/* total minus the lowest score, then return average */
return (float)(total-min)/4;
}
back