|
|
@ -1,4 +1,4 @@
|
|
|
|
include<stdio.h>
|
|
|
|
#include<stdio.h>
|
|
|
|
#include<math.h>
|
|
|
|
#include<math.h>
|
|
|
|
#include<stdlib.h>
|
|
|
|
#include<stdlib.h>
|
|
|
|
#define n 2
|
|
|
|
#define n 2
|
|
|
@ -93,6 +93,71 @@ l: printf("\n
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ice,i,j,t;
|
|
|
|
|
|
|
|
int a[n];
|
|
|
|
|
|
|
|
int sign;
|
|
|
|
|
|
|
|
do
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\n** 1.按学校编号输出 **\n");
|
|
|
|
|
|
|
|
printf("** 2.按学校总分输出 **\n");
|
|
|
|
|
|
|
|
printf("** 3.按男团总分输出 **\n");
|
|
|
|
|
|
|
|
printf("** 4.按女团总分输出 **\n");
|
|
|
|
|
|
|
|
printf("** 请根据提示进行操作!: **");
|
|
|
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
switch(choice)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case 1:for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\n学校编号:%d\n",h[i].schoolnum);
|
|
|
|
|
|
|
|
printf("学校总分:%d\n",h[i].score);
|
|
|
|
|
|
|
|
printf("男团总分:%d\n",h[i].mscore);
|
|
|
|
|
|
|
|
printf("女团总分:%d\n",h[i].wscore);
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
a[i]=i;
|
|
|
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for(j=i+1;j<n;j++)
|
|
|
|
|
|
|
|
if(h[a[i]].score<h[j].score)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
t=a[i];
|
|
|
|
|
|
|
|
a[i]=a[j];
|
|
|
|
|
|
|
|
a[j]=t;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\n 学校编号:%d \n",h[a[i]].schoolnum);
|
|
|
|
|
|
|
|
printf(" 学校总分:%d \n",h[a[i]].score);
|
|
|
|
|
|
|
|
printf(" 男团总分:%d \n",h[a[i]].mscore);
|
|
|
|
|
|
|
|
printf(" 女团总分:%d \n",h[a[i]].wscore);
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
a[i]=i;
|
|
|
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for(j=i+1;j<n;j++)
|
|
|
|
|
|
|
|
if(h[a[i]].mscore<h[j].mscore)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
t=a[i];
|
|
|
|
|
|
|
|
a[i]=a[j];
|
|
|
|
|
|
|
|
a[j]=t;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf(" 学校编号:%d \n",h[a[i]].schoolnum);
|
|
|
|
|
|
|
|
printf(" 学校总分:%d \n",h[a[i]].score);
|
|
|
|
|
|
|
|
printf(" 男团总分:%d \n",h[a[i]].mscore);
|
|
|
|
|
|
|
|
printf(" 女团总分:%d \n",h[a[i]].wscore);
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
|
{ FILE *fp;
|
|
|
|
{ FILE *fp;
|
|
|
|
|
|
|
|
|
|
|
|