注意一下变量的数据类型就行
#include<iostream>
#include<iomanip>using namespace std;
int main()
{
int n;
while(cin>>n)
{
int i,high=0,low=100;
double sum=0,grade;
for(i=1;i<=n;i++)
{
cin>>grade;
sum+=grade;
if(grade>high) high=grade;
if(grade<low) low=grade;
}
sum-=(high+low);
grade=sum/(n-2.0);
cout<<setiosflags(ios::fixed)<<setprecision(2)<<grade<<endl;
}
}