This is a homework problem, but the only problem I am having trouble with is taking 5 scores, getting rid of the highest and lowest, then averaging out the rest. In the snippet below, it is only taking the last number entered, but not the rest. I have figured this out by reversing the numbers in different orders.
Not asking this to be solved, but where do I need to look. The score range is 0-10, largest is set at 0 and smallest is set at 11 (to allow everything else to be smaller initially.)
int largest = 1 , smallest = 0 ;
if( a > largest )
{
largest = a ;
}
elseif( a < smallest )
{
smallest = a ;
}
elseif( smallest < a && a < largest )
{
sum += a ;
average = sum / z ;
}
tycose2014 excuse, if I translated correctly, you mean the average of the numbers between the smallest and largest, excluding the extremes themselves. then you should enter another variable, int average ..