int findMin(int t1, int t2, int t3, int t4, int t5)
{
int min1, min2, min3;
min1 = std::min(t1, t2);
min2 = std::min(t3, t4);
min3 = std::min(min1, min2);
return std::min(min3, t5);
}
int findMax(int t1, int t2, int t3, int t4, int t5)
{
int max1, max2, max3;
max1 = std::max(t1, t2);
max2 = std::max(t3, t4);
max3 = std::max(max1, max2);
return std::max(max3, t5);
}
These functions are very messy but easy to follow and thus easy to remember and it only uses the simple min and max methods which work best for 2 values.