/*
*copyright (c)2014,烟台大学计算机学院
*All rights reserved
*文件名称:qwe.cpp
*作者:孙春红
*完成日期:2014年11月3日
*版本号:v1.0
*
*问题描述:在歌手大赛中,有10个评委为参赛选手打分,分数为0-10分,选手最后得分,去掉一个最低温,去点一个最高分,取其余8个分数求平均值。
*/
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int i=1,sum=0,score,min,max;
double a;
cout <<"请输入选手的成绩(0-10)"<<endl;
do
{
cout <<"第"<<i<<"位评委的成绩:";
cin >>a;
sum=sum+a;
i++;
if(max<a)
max=a;
if (min>a)
min=a;
}while (i<=10);
score=(sum-max-min)/(n-2);
cout <<"减去一个最高分:"<<max<<" ";
cout<<"减去一个最低分:"<<min<<endl;
cout <<"当前选手的最后得分为:"<<score<<endl;
return 0;
}
运行结果:
知识点总结:
运用循环语句等知识编写程序
学习心得:
在使用循环语句时,运行了好几种方式,甚至在一个程序里连这些了两个,最后经过改正,都匀到一个上,才出现的运行结果。(不知道运行结果是否正确)
这个程序在第一编发的时候出现了错误,最后改正了。