With C++11, some code may be simplified:
double findLowest (double aaa, double bbb, double ccc, double ddd, double eee)
{
return std::min({aaa, bbb, ccc, ddd, eee});
}
double findHighest (double aaa, double bbb, double ccc, double ddd, double eee)
{
return std::max({aaa, bbb, ccc, ddd, eee});
}
But if you use array and algorithm, the code may be simplified even more:
/* calcScore calculates and return the average of 4 scores that remain after
dropping the highest and lowest scores of the performer revieced. */
double calcScore(const double (&a)[5])
{
auto it = std::minmax_element(std::begin(a), std::end(a));
return (std::accumulate(std::begin(a), std::end(a), 0.)) - (*it.first + *it.second)) / 3;
}
int main ()
{
double judges[5];
// Ask for the score of each judge
for (auto& judge : judges) {
getJudgeData(judge);
std::cout << judge << std::endl;
}
//Outputs the average value
avgValue = calcScore(judges);
std::cout << avgValue;
return 0;
}