* copyright (c) 2014 , 烟台大学计算机学院
* all rights reserved .
* 文件名称 : textst . cpp
* 作者 : 孙旭明
* 完成日期 : 2014年11月7日
* 版本号 : v1.0
*
* 问题描述 :在歌手大赛中,由若干评委为参赛选手打分,分数为0--10分,选手最后的得分为
* 程序输入 : 若干个评委为参赛的选手打分。
* 程序输出 : 选手最后的得分为:去掉一个最大值,一个最小值,取其余分数的平均值。
*/
#include <iostream>
#include <iomanip>
#include <cstdio>
using namespace std;
int main()
{
double s,t,sum=0,max=0,min=10;
int i=1,p;
cout <<"请输入评委的人数:"<<endl;
cin>>p;
cout << "请输入选手的成绩(0-10):" << endl;
while (i<=p)
{
cin>>s;
if ( s>=0&&s<=10)
{
cout <<"第"<<i<<"位评委给分:"<<s<<""<<endl;
sum+=s;
if (max <s)
max=s;
if ( min>s)
min=s;
i++;
}
else
{
cout <<"分数不在正确范围内,请检查并重新输入该选手的分数"<<endl;
continue;
}
}
t =(sum-max-min )/(p-2);
cout <<"减去一个最高分:"<<max <<"分,"<<"减去一个最低分:"<<min <<"分,"<<endl;
cout <<"当前选手的最后得分是:"<<t<<"分,"<<endl;
char *pt ="SUCCESS";
cout <<setfill('*')<<setw (20) <<pt<<"********************"<<endl;
return 0;
}