<pre class="cpp" name="code">问题及代码
*作者:李长鸿
*时间:2014.11.03
*问题:计算比赛中选手得分
*问题输入:评委打分
*问题输出:选手得分
*/ #include <iostream>
using namespace std;
int main()
{
int i;
double a=0,b=10,c=0.0,x,grade;
cin>>x;
if(x<=10&&x>=0)
{
for(i=1; i<=10; i++)
{
c+=x;
if(a<=x)
a=x;
if(b>=x)
b=x;
cout<<"第"<<i<<"位评委给分: "<<x<<endl;
if(i>=10) break;
cin>>x;
}
grade=(c-a-b)/8;
cout<<"减去一个最高分"<<a<<","<<"减去一个最低分"<<b<<"."<<endl;
cout<<"当前选手的最后得分为"<<grade<<endl;
}
else cout<<"输入有误,请重新输入"<<endl;
return 0;
}