|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
void sortexam(char *b[],char *name[],int f[],float c[],float d[],float e[],float g[],int h,int n)/*<2A>༶<EFBFBD>ڳɼ<DAB3><C9BC><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
int t=0;
|
|
|
|
|
char a='0';
|
|
|
|
|
char *p=&a;
|
|
|
|
|
float k=0;
|
|
|
|
|
for(i=h;i<=n;i++)/*ð<><C3B0>*/
|
|
|
|
|
for(j=h;j<=n-i;j++)
|
|
|
|
|
{
|
|
|
|
|
if(g[j]<g[j+1])
|
|
|
|
|
{
|
|
|
|
|
p=b[j];
|
|
|
|
|
b[j]=b[j+1];
|
|
|
|
|
b[j+1]=p;
|
|
|
|
|
p=name[j];
|
|
|
|
|
name[j]=name[j+1];
|
|
|
|
|
name[j+1]=p;
|
|
|
|
|
c[j]=c[j+1];
|
|
|
|
|
c[j+1]=k;
|
|
|
|
|
k=d[j];
|
|
|
|
|
d[j]=d[j+1];
|
|
|
|
|
d[j+1]=k;
|
|
|
|
|
k=e[j];
|
|
|
|
|
e[j]=e[j+1];
|
|
|
|
|
e[j+1]=k;
|
|
|
|
|
k=g[j];
|
|
|
|
|
g[j]=g[j+1];
|
|
|
|
|
g[j+1]=k;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void sortclass(char *b[],char *name[],int f[],float c[],float d[],float e[],float g[],int n)/*<2A>༶<EFBFBD><E0BCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
char a='0';
|
|
|
|
|
char *p=&a;
|
|
|
|
|
int t=0;
|
|
|
|
|
float k=0;
|
|
|
|
|
for(i=1;i<=n;i++)/*ð<><C3B0>*/
|
|
|
|
|
for(j=1;j<=n-i;j++)
|
|
|
|
|
{
|
|
|
|
|
if(f[j]>f[j+1])
|
|
|
|
|
{
|
|
|
|
|
t=f[j];/*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
f[j]=f[j+1];
|
|
|
|
|
f[j+1]=t;
|
|
|
|
|
p=b[j];
|
|
|
|
|
b[j]=b[j+1];
|
|
|
|
|
b[j+1]=p;
|
|
|
|
|
p=name[j];
|
|
|
|
|
name[j]=name[j+1];
|
|
|
|
|
name[j+1]=p;
|
|
|
|
|
k=c[j];
|
|
|
|
|
c[j]=c[j+1];
|
|
|
|
|
c[j+1]=k;
|
|
|
|
|
k=d[j];
|
|
|
|
|
d[j]=d[j+1];
|
|
|
|
|
d[j+1]=k;
|
|
|
|
|
k=e[j];
|
|
|
|
|
e[j]=e[j+1];
|
|
|
|
|
e[j+1]=k;
|
|
|
|
|
k=g[j];
|
|
|
|
|
g[j]=g[j+1];
|
|
|
|
|
g[j+1]=k;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int deletename(char *b[],char *name[],int f[],float c[],float d[],float e[],float g[],int n)/*ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
int k;/*<2A><><EFBFBD>泤<EFBFBD><E6B3A4>*/
|
|
|
|
|
k=n;
|
|
|
|
|
char a[1001];
|
|
|
|
|
scanf("%s",&a);
|
|
|
|
|
for(i=1;i<=n;i++)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(b[i],a)==0||strcmp(name[i],a)==0)/*<2A>Ƚ<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
k--;
|
|
|
|
|
for(j=i;j<=n;j++)
|
|
|
|
|
{
|
|
|
|
|
b[j]=b[j+1];
|
|
|
|
|
name[j]=name[j+1];
|
|
|
|
|
f[j]=f[j+1];
|
|
|
|
|
c[j]=c[j+1];
|
|
|
|
|
d[j]=d[j+1];
|
|
|
|
|
e[j]=e[j+1];
|
|
|
|
|
g[j]=g[j+1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return k;
|
|
|
|
|
}
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
char s[1001];
|
|
|
|
|
char a[10001];
|
|
|
|
|
int i;
|
|
|
|
|
int k;
|
|
|
|
|
int n=3;
|
|
|
|
|
char *b[1001]={"0","10001","10002","10003","0"};/*ѧ<><D1A7>*//*ѧ<>ղ<EFBFBD><D5B2><EFBFBD><EFBFBD><EFBFBD>ʹ*/
|
|
|
|
|
char *name[1001]={"0","Zhang","Yang","Liang","0"};/*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
int f[1001]={0,11,12,11};/*<2A>༶*/
|
|
|
|
|
float c[1001]={0,99.5,77.9,92.5},d[1001]={0,88.5,56.5,99.0},e[1001]={0,89.5,87.5,60.5};/*<2A>ɼ<EFBFBD>*/
|
|
|
|
|
float g[1001]={0};/*<2A>ܳɼ<DCB3>*/
|
|
|
|
|
for(i=1;i<=3;i++)
|
|
|
|
|
g[i]=c[i]+d[i]+e[i];
|
|
|
|
|
n=deletename(b,name,f,c,d,e,g,3);
|
|
|
|
|
sortclass(b,name,f,c,d,e,g,n);
|
|
|
|
|
k=1;/*ǰ<><C7B0>*/
|
|
|
|
|
for(i=1;i<=n;i++)
|
|
|
|
|
{
|
|
|
|
|
if(f[i+1]!=f[k])
|
|
|
|
|
{
|
|
|
|
|
sortexam(b,name,f,c,d,e,g,k,i);
|
|
|
|
|
k=i+1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(i=1;i<=n;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%s %d %s %.1f %.1f %.1f",b[i],f[i],name[i],c[i],d[i],e[i]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
printf("Are you sure(yes/no)?\n");
|
|
|
|
|
scanf("%s",&a);
|
|
|
|
|
if(strcmp(a,"n")==0)
|
|
|
|
|
{
|
|
|
|
|
for(i=1;i<=n;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%s %d %s %.1f %.1f %.1f",b[i],f[i],name[i],c[i],d[i],e[i]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|