# Include <iostream>
# Include <fstream>
Using namespace STD;
Int A [100]; // an array containing the integer read from the file
Int n = 0; // in the record Array
// Returns the maximum value in the array.
Int maxa (int A [], int N)
{
Int max = A [0];
For (INT I = 1; I <n; I ++)
{
If (A [I]> MAX)
Max = A [I];
}
Return Max;
}
// Returns the minimum value in the array.
Int Mina (int A [], int N)
{
Int min = A [0];
For (INT I = 1; I <n; I ++)
If (A [I] <min)
Min = A [I];
Return min;
}
Int main ()
{
Ifstream in ("score.txt", IOS: In );
If (! In)
{
Cerr <"Open File error! "<Endl;
Exit (1 );
}
// Read the numbers in the file into the Global Array a [] in sequence
While (in. Peek ()! = EOF)
In> A [n ++];
In. Close (); // close the file
Int sum = 0; // measure the size of the content in the array.
For (INT I = 0; I <n; I ++)
Sum + = A [I];
Int max = maxa (A, N );
Int min = Mina (A, N );
Float average = (Sum-max-min)/(n-2 );
Cout <"/> the average of the score is:" <average <Endl;
Return 0;
}