歌唱比赛选手评分系统_歌唱比赛评分系统

2020-02-28 其他范文 下载本文

歌唱比赛选手评分系统由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“歌唱比赛评分系统”。

#include

#include

#include

#include

#define NUM 10

void zr();

void search();

static struct compete

{

int num;

char name[20];

double score[11];

int range;

}compete[NUM];

void main()

{

zr();

}

double max[NUM],min[NUM],sum[NUM];void input(){

int i,j,temp,a;

double maxscore;double tempscore;

char tempname[20];for(i=0;i

{

printf(“请输入选手编号:”);

scanf(“%d”,&a);

getchar();

if(a==0)

zr();

compete[i].num=a;

printf(“请输入选手选手姓名:”);scanf(“%s”,compete[i].name);compete[i].range=i+1;

for(j=0;j

printf(“%d号评委打分:”,j+1);scanf(“%lf”,&compete[i].score[j]);}

}

getchar();

for(i=0;i

max[i]=min[i]=compete[i].score[0];

for(j=0;j

{

if(compete[i].score[j]>max[i])

max[i]=compete[i].score[j];

if(compete[i].score[j]

min[i]=compete[i].score[j];

}

}

for(i=0;i

{

sum[i]=0;

for(j=0;j

sum[i]+=compete[i].score[j];

compete[i].score[10]=(sum[i]-max[i]-min[i])/8.0;

}

for(i=0;i

{

maxscore=compete[i].score[10];

for(j=i+1;j

if(compete[j].score[10]>compete[i].score[10])

{

temp=compete[i].num;

compete[i].num=compete[j].num;

compete[j].num=temp;

strcpy(tempname,compete[i].name);

strcpy(compete[i].name,compete[j].name);

strcpy(compete[j].name,tempname);

tempscore=compete[i].score[10];

compete[i].score[10]=compete[j].score[10];

compete[j].score[10]=tempscore;

}

}

system(“pause”);

zr();

}

void searchnum()

{

int i,j,flag=0;

printf(“请输入你想查询的选手编号:”);

scanf(“%d”,&j);

getchar();

for(i=0;i

if(compete[i].num==j)

{

printf(“编号t姓名tt平均分t名次t最高分t最低分n”);

printf(“%dt%stt%.2lft%dt%.2ft%.2fn”,compete[i].num,compete[i].name,compete[i].score[10],compete[i].range,max[i],min[i]);

flag=1;

break;

}

}

if(flag!=1)

printf(“没有此项资料n”);

system(“pause”);

search();

}

void searchname()

{

int i,flag=0;

char a[20];

printf(“请输入你想查询的选手名字:”);

gets(a);

for(i=0;i

{

if(!strcmp(compete[i].name,a))

{

printf(“编号t姓名tt平均分t名次t最高分t最低分n”);

printf(“%dt%stt%.2lft%dt%.2ft%.2fn”,compete[i].num,compete[i].name,compete[i].score[10],compete[i].range,max[i],min[i]);

flag=1;

break;

}

}

if(flag!=1)

printf(“没找到n”);

system(“pause”);

search();

}

void search()

{

char c;

system(“cls”);

printf(“nnnn”);

printf(“tt**********1---按选手编号查询********** n”);printf(“tt**********2---按选手姓名查询********** n”);printf(“tt**********3---返回上级菜单********** n”);printf(“nnt请选择:”);

c=getchar();

getchar();

switch(c)

{

case '1':searchnum();break;

case '2':searchname();break;

case '3':zr();

default:printf(“输入错误”);system(“pause”);

}

search();

}

void zr()

{

char c;

do

{

system(“cls”);

printf(“nnttt歌唱比赛评分查询nnn”);

printf(“tt*****1---输入选手的编号、姓名及所得分数***** nn”);printf(“tt*****2---查询选手的最后得分***** nn”);printf(“tt*****3---退出程序***** nn”);printf(“nntt选择:”);

c=getchar();

getchar();

switch(c)

{

case '1':system(“cls”);input();break;

case '2':system(“cls”);search();break;

case '3':c='n';exit(0);

default:zr();

}

}while(0);

}

《歌唱比赛选手评分系统.docx》
将本文的Word文档下载,方便收藏和打印
推荐度:
歌唱比赛选手评分系统
点击下载文档
相关专题 歌唱比赛评分系统 选手 评分 系统 歌唱比赛评分系统 选手 评分 系统
[其他范文]相关推荐
    [其他范文]热门文章
      下载全文