|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEBAAF><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>亯<EFBFBD><E4BAAF> eg:exit()
|
|
|
|
|
#include<string.h> //<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
#define N 3
|
|
|
|
|
#define M 10
|
|
|
|
|
int add = N - 1;
|
|
|
|
|
int sum[N] = { 0 }, Max[N], Min[N];
|
|
|
|
|
float aver[N] = { 0 };
|
|
|
|
|
struct player //<2F>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int num; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char name[8]; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
int score[M]; //<2F>÷<EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void Inistplayer(struct player a[], int n)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
|
scanf("%d %s", &a[i].num, a[i].name); //¼<><C2BC>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
void Inputscore(int score[], int n) //<2F><>ί<EFBFBD><CEAF><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
|
scanf("%d",&score[i]);
|
|
|
|
|
}
|
|
|
|
|
void sort(struct player a[], float b[], int n) //sort==<3D><><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i, k, j,t;
|
|
|
|
|
float temp; //temp:<3A><>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
//struct player temp1;
|
|
|
|
|
char str[10];
|
|
|
|
|
for (i = 0; i < n-1; i++)
|
|
|
|
|
{
|
|
|
|
|
k = i;
|
|
|
|
|
for (j = i + 1; j < n; j++)
|
|
|
|
|
if (b[k] > b[j])
|
|
|
|
|
k = j;
|
|
|
|
|
if (k != i)
|
|
|
|
|
{
|
|
|
|
|
temp = b[i];
|
|
|
|
|
b[i] = b[k];
|
|
|
|
|
b[k] = temp;
|
|
|
|
|
strcpy(str, a[i].name); //strcpy<70>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ĵĿ⺯<C4BF><E2BAAF>
|
|
|
|
|
strcpy(a[i].name, a[k].name);
|
|
|
|
|
strcpy(a[k].name, str);
|
|
|
|
|
t = a[i].num;
|
|
|
|
|
a[i].num = a[k].num;
|
|
|
|
|
a[k].num = t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
int flag = 1, n, i, m, j,r=1; //flag:<3A>жϱ<D0B6>־
|
|
|
|
|
FILE *fp;
|
|
|
|
|
struct player a[20];
|
|
|
|
|
printf("||=========================================================================||\n");
|
|
|
|
|
printf("||============================<3D><><EFBFBD>˵<EFBFBD>=======================================||\n");
|
|
|
|
|
printf("||************************<2A><><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ*********************************||\n");
|
|
|
|
|
printf("||=========================================================================||\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("||=========================================================================||\n");
|
|
|
|
|
printf("||*************************************************************************||\n");
|
|
|
|
|
printf("||*************************************************************************||\n");
|
|
|
|
|
while(flag)
|
|
|
|
|
{ printf("\n");
|
|
|
|
|
printf("<EFBFBD>밴1-7<><37>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
abc:
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
if(r==n)
|
|
|
|
|
{ r++;
|
|
|
|
|
switch(n)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λѡ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> eg:1 XXX)<29><>\n") ; //<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Inistplayer(a,N);
|
|
|
|
|
break;
|
|
|
|
|
case 2: //<2F><>ί<EFBFBD><CEAF><EFBFBD><EFBFBD>
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%dλѡ<CEBB>ֵijɼ<C4B3> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʮ<EFBFBD><CAAE>[0,10]<5D><>, eg<65><67>1 2 ...)<29><>",i+1);
|
|
|
|
|
Inputscore(a[i].score,M); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ί<EFBFBD><CEAF><EFBFBD><EFBFBD>
|
|
|
|
|
for(j=0;j<M;j++)
|
|
|
|
|
printf("%d\t",a[i].score[j]); //<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD>ֵĸ<D6B5><C4B8>Ե÷<D4B5>
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3: //<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
{
|
|
|
|
|
Max[i]=a[i].score[0];
|
|
|
|
|
Min[i]=a[i].score[0];
|
|
|
|
|
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];
|
|
|
|
|
}
|
|
|
|
|
aver[i]=(float)(sum[i]-Max[i]-Min[i])/(M-2); //<2F><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sort(a,aver,N); //<2F><>a[0]<5D><>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
printf("%s\t%5.2f\n",a[i].name,aver[i]);
|
|
|
|
|
break;
|
|
|
|
|
case 4: //<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ѡ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD> eg<65><67>1<EFBFBD><31><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&m); //mΪ<6D><CEAA>ѡ<EFBFBD>ֱ<EFBFBD><D6B1>ŵı<C5B5><C4B1><EFBFBD>
|
|
|
|
|
for(i=0;i<N;i++)
|
|
|
|
|
if(a[i].num==m)
|
|
|
|
|
{
|
|
|
|
|
printf("%d <20><>ѡ<EFBFBD><D1A1>%s <20>ܷ<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],aver[i]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5: //<><D7B7>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ӵ<EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> eg<65><67>1 XXX):");
|
|
|
|
|
add=add+1;
|
|
|
|
|
scanf("%d %s",&a[add].num,a[add].name);
|
|
|
|
|
break;
|
|
|
|
|
case 6: //д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n\n");
|
|
|
|
|
fp=fopen("date.txt","w");
|
|
|
|
|
for(i=0;i<add+2;i++)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"%d %s\n",a[i].num,a[i].name);
|
|
|
|
|
}
|
|
|
|
|
printf("д<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n\n");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
break;
|
|
|
|
|
case 7: //<2F>˳<EFBFBD>ϵͳ
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
flag=0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
goto abc; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|