|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#define M 10
|
|
|
|
|
#define N 3
|
|
|
|
|
int add = N-1;
|
|
|
|
|
int sum[N]={0},Max[N],Min[N];
|
|
|
|
|
float aver[N]={0};
|
|
|
|
|
struct player
|
|
|
|
|
{
|
|
|
|
|
int num;//ѡ<>ֱ<EFBFBD><D6B1><EFBFBD>//
|
|
|
|
|
char name[10];//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//
|
|
|
|
|
int score[10];//ʮ<><CAAE><EFBFBD><EFBFBD>ί<EFBFBD>ijɼ<C4B3>//
|
|
|
|
|
float aver[10];//ƽ<><C6BD><EFBFBD>ɼ<EFBFBD>//
|
|
|
|
|
};
|
|
|
|
|
void inplayerinfo(struct player a[],int n) //<2F>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>//
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
scanf("%d %s",&a[i].num,&a[i].name);
|
|
|
|
|
}
|
|
|
|
|
void Inputscore(int score[],int n) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɼ<C9B3>//
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
scanf("%d",&score[i]); //<2F><>ί<EFBFBD><CEAF>ÿλѡ<CEBB>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//
|
|
|
|
|
}
|
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
int end=1,n,i,m,j;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("date.text","w+");
|
|
|
|
|
struct player a[20];
|
|
|
|
|
printf(" +----------<2D><>ӭʹ<D3AD>ø質<C3B8><E8B3AA><EFBFBD><EFBFBD>2.0ϵͳ--------+ \n");
|
|
|
|
|
printf(" |**************1.<2E><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*************| \n");
|
|
|
|
|
printf(" |**************2.<2E><>ί<EFBFBD><CEAF><EFBFBD><EFBFBD>*****************| \n");
|
|
|
|
|
printf(" |**************3.<2E>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>*****************| \n");
|
|
|
|
|
printf(" |**************4.<2E><><EFBFBD>ݲ<EFBFBD>ѯ*****************| \n");
|
|
|
|
|
printf(" |**************5.<><D7B7>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*************| \n");
|
|
|
|
|
printf(" |**************6.д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*************| \n");
|
|
|
|
|
printf(" |**************7.<2E>˳<EFBFBD>ϵͳ*****************| \n");
|
|
|
|
|
printf(" |---------------<2D><><EFBFBD>Ϲ<EFBFBD>ҵ<EFBFBD><D2B5>ѧ--------------| \n");
|
|
|
|
|
printf(" +*****************<2A><EFBFBD><EEB3AC>******************+ \n");
|
|
|
|
|
while(end)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
switch(n)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>ֵIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
inplayerinfo(a,N);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>%dλѡ<CEBB>ֵijɼ<C4B3>:",i+1);
|
|
|
|
|
Inputscore(a[i].score,M);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
{
|
|
|
|
|
Max[i]=a[i].score[0];
|
|
|
|
|
Min[i]=a[i].score[0]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬѧ<CDAC><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷֳ<CDB7>ʼֵ//
|
|
|
|
|
for(j=0;j<M;j++)
|
|
|
|
|
{
|
|
|
|
|
sum[i]+=a[i].score[j];
|
|
|
|
|
if(Max[i]<a[i].score[j]) Max[i]=a[i].score[j];
|
|
|
|
|
if(Min[i]>a[i].score[j]) Min[i]=a[i].score[j]; //<2F>ҵ<EFBFBD>ÿ<EFBFBD><C3BF>ͬѧ<CDAC>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>߷ֺ<DFB7><D6BA><EFBFBD><EFBFBD>ͷ<EFBFBD>//
|
|
|
|
|
}
|
|
|
|
|
a[i].aver[10]=(float)(sum[i]-Max[i]-Min[i])/(M-2); //<2F><><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD>߷ֺ<DFB7><D6BA><EFBFBD><EFBFBD>ͷֺ<CDB7><D6BA><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD>//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(i=0;i<N-1;i++)
|
|
|
|
|
{
|
|
|
|
|
for(j=0;j<N-i-1;j++)
|
|
|
|
|
{
|
|
|
|
|
if(a[j].aver[10]<a[j+1].aver[10])
|
|
|
|
|
{
|
|
|
|
|
int temp;
|
|
|
|
|
temp=a[j].aver[10];
|
|
|
|
|
a[j].aver[10]=a[j+1].aver[10];
|
|
|
|
|
a[j+1].aver[10]=temp;
|
|
|
|
|
char t[10];
|
|
|
|
|
t[10]=*a[j].name;
|
|
|
|
|
*a[j].name=*a[j+1].name;
|
|
|
|
|
*a[j+1].name=t[10];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
printf("%s %5.2f\n",a[i].name,a[i].aver[10]);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯѡ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&m);
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
if(a[i].num==m)
|
|
|
|
|
{
|
|
|
|
|
printf("%d<><64>ѡ<EFBFBD><D1A1>%s<>ܷ<EFBFBD>:%d,<2C><><EFBFBD>߷<EFBFBD>%d,<2C><><EFBFBD>ͷ<EFBFBD>%d,ƽ<><C6BD><EFBFBD><EFBFBD>%5.2f",a[i].num,a[i].name,sum[i],Max[i],Min[i],a[i].aver[10]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ӵ<EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>\n");
|
|
|
|
|
add += 1;
|
|
|
|
|
scanf("%d %s",&a[add].num,&a[add].name);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD>\n");
|
|
|
|
|
for (i = 0 ; i < add+1 ; i++)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"%d ",a[i].num);
|
|
|
|
|
fprintf(fp,"%s ",a[i].name);
|
|
|
|
|
fprintf(fp,"%d\n",a[i].score);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
default:end=0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|