#include <stdioh>
int main(void)
{
int i, j ;
int s[10];
int temp;
int alls=0;
for(i=0;i<10;i++)
{//输入分数
printf("\n请输入第%d名评委的打分:",i+1);
scanf("%d",s+i);
}
for(i=0;i<10;i++)
{//排序
for(j=0;j<10-i;j++)
{
if(s[j]<s[j+1])
{
temp=s[j];
s[j]=s[j+1];
s[j+1]=temp;
}
}
}
for(i=1;i<9;i++)
{
alls+=s[i];
}//计算s[1]到s[8]的和,去掉了最小和最大的s[0],s[9]
printf("\n\n最后得分为:%f\n\n",(int)alls/80);
return 0;
}
#include<stdioh>
struct Judge
{
char name[20];
int grade;
};
int main(void)
{
struct Judge judges[20];
int a,i,t1,t2,ma,sum=0;
float average_socer;
printf("the number of the judges is:”);
scanf("%d",&a);
for(i=0;i<a;i++)
{
printf("\nname is ");
scanf("%s",judges[i]name);
printf("\nscore=");
scanf("%d",&judges[i]grade);
}
ma=0;
for(i=0;i<a;i++)
{
if(ma<judges[i]grade)
{
ma=judges[i]grade;
t1=i;
}
}
for(i=0;i<a;i++)
{
if(ma>judges[i]grade)
{
ma=judges[i]grade;
t2=i;
}
}
for(i=0;i<a;i++)
sum=sum+judges[i]grade;
sum=sum-judge[t1]name-judge[t2]name
average_socer=sum/(float)(a-2);
printf("\nthe max: \n name:%s \n score:%d \n",judges[t1]name,judges[t1]grade);
printf("\nthe min: \n name:%s \n score:%d \n",judges[t2]name,judges[t2]grade);
printf("\nthe average score:%f",average_socer);
return 0;
}
#include <stdioh>
#include<stringh>
void main()
{
int i,j,m,n;
float num,xgrade[100],max,min,pgrade[100],pdis[100];
char str[10],xname[100][10],pname[100][10];
printf("请输入评委人数:");
scanf("%d",&m);
printf("\n请分别输入评委姓名:\n");
for(i=0;i<m;i++)
{
scanf("%s",&pname[i]);//评委姓名
pgrade[i]=0;//评委给的分
pdis[i]=0;//评委给分和最后结果的差距
}
printf("\n请输入选手人数:");
scanf("%d",&n);
printf("\n请分别输入选手姓名:\n");
for(i=0;i<n;i++)
{
scanf("%s",&xname[i]);//选手姓名
xgrade[i]=0;//选手成绩
}
for(i=0;i<n;i++)
{
max=0;min=10;//评委给选手的最大最小成绩
printf("\n请给选手%s打分!",xname[i]);
for(j=0;j<m;j++)
{
printf("\n%s老师给的分数为:",pname[j]);
scanf("%f",&pgrade[j]);
xgrade[i]+=pgrade[j];//加到该选手的总分数中
if(max<pgrade[j])
max=pgrade[j];
if(min>pgrade[j])
min=pgrade[j];
}
xgrade[i]=(xgrade[i]-max-min)/(m-2);//最后成绩为总成绩-最高分-最低分,然后平均
for(j=0;j<m;j++)//算出每个评委本次评分和最终成绩的差,加到pdis中保存起来
{
pdis[j]+=pgrade[j]>xgrade[i](pgrade[j]-xgrade[i]):(xgrade[i]-pgrade[j]);
}
}
for(i=0;i<n-1;i++)
for(j=0;j<n-1-i;j++)
if(xgrade[j]<xgrade[j+1])
{
strcpy(str,xname[j]);
strcpy(xname[j],xname[j+1]);
strcpy(xname[j+1],str);
num=xgrade[j];
xgrade[j]=xgrade[j+1];
xgrade[j+1]=num;
}
printf("\n选手按名次排名为:\n");
printf("选手名\t得分\n");
for(i=0;i<n;i++)
printf("%s\t%f\n",xname[i],xgrade[i]);
for(i=0;i<m-1;i++)
for(j=0;j<m-1-i;j++)
if(pdis[j]>pdis[j+1])
{
strcpy(str,pname[j]);
strcpy(pname[j],pname[j+1]);
strcpy(pname[j+1],str);
num=pdis[j];
pdis[j]=pdis[j+1];
pdis[j+1]=num;
}
printf("\n评委按名次排名为:\n");
printf("评委名\t差分\n");
for(i=0;i<m;i++)
printf("%s\t%f\n",pname[i],pdis[i]);
}
vaela
#include<stdioh>
#include<conioh>
#define _for(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int scores[10];
double average,maxn,minn=0x7f,imax,imin;
int main(){
system("cls");
_for(i,0,10){
printf("Please input a score:");
scanf("%d",&scores[i]);
average+=scores[i];
if(maxn<scores[i]){
maxn=scores[i];
imax=i;
}
if(minn>scores[i]){
minn=scores[i];
imin=i;
}
printf("\n");
}
average-=maxn+minn;
average/=80;
printf("\nThe average: %6lf\n",average);
printf("The max: %6lf\n",maxn);
printf("The min: %6lf\n",minn);
_for(i,0,10){
if(scores[i]>average){
printf("%d,%6lf\n",i+1,double(maxn));
}
}
printf("max: %d,%6lf\n",imax+1,maxn);
printf("min: %d,%6lf\n\n",imin+1,minn);
printf("Next singer < y or Y>: ");
char k=getch();
if(k=='y' || k=='Y')main();
return 0;
}
以上就是关于c语言程序设计 评委打分全部的内容,包括:c语言程序设计 评委打分、用C语言。评委打分,输入评委人数及其相应打分,去掉最高最低分,求、c语言编程:歌唱比赛评委评分系统等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)