我的程序:#include <iostream>
using namespace std;
double max(double x,double y);
double min(double x,double y);
int main()
{
double a,b,c,d,e,f,j,k,m,n,z,y,w;//w为选手最后得分
cout<<"请输入10位评委的分数(0~10)"<<endl;
cout<<"第一位评委的分数:";
cin>>a;
cout<<"第二位评委的分数:";
cin>>b;
cout<<"第三位评委的分数:";
cin>>c;
cout<<"第四位评委的分数:";
cin>>d;
cout<<"第五位评委的分数:";
cin>>e;
cout<<"第六位评委的分数:";
cin>>f;
cout<<"第七位评委的分数:";
cin>>m;
cout<<"第八位评委的分数:";
cin>>n;
cout<<"第九位评委的分数:";
cin>>k;
cout<<"第十位评委的分数:";
cin>>j;
z=max(a,max(b,max(c,max(d,max(e,max(f,max(j,max(k,max(m,n)))))))));
y=min(a,min(b,min(c,min(d,min(e,min(f,min(j,min(k,min(m,n)))))))));
w=(a+b+c+d+e+f+j+k+m+n-z-y)/8;
cout<<"w="<<w<<endl;
return 0;
}
double max(double x, double y)
{ double num1;
if(x>y)
num1=x;
else
num1=y;
return num1;
}
double min(double x,double y)
{ double num2;
if(x<y)
num2=x;
else
num2=y;
return num2;
}
心得体会:咯