#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct students
{
char a[10];
char b[10];
int c;
int d;
int e;
};
void G (struct students student[3])
{ int i;
for(i=0;i<3;i++)
{
printf("请输入学生的姓名 性别 学号 年龄 成绩:");
scanf("%s%s%d%d%d",&student[i].a,&student[i].b,&student[i].c,&student[i].d,&student[i].e) ;
}
}
void j(struct students s[3])
{
int i,j,t;
char *c;
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
if(s[j].e<s[j+1].e)
{
t=s[j].e;
s[j].e=s[j+1].e;
s[j+1].e=t;
strcpy(c,s[j].a);
strcpy(s[j].a,s[j+1].a);
strcpy(s[j+1].a,c);
strcpy(c,s[j].b);
strcpy(s[j].b,s[j+1].b);
strcpy(s[j+1].b,c);
t=s[j].c;
s[j].c=s[j+1].c;
s[j+1].c=t;
t=s[j].d;
s[j].d=s[j+1].d;
s[j+1].d=t;
}
}
}
}
void put ( struct students student[3])
{ int i;
for(i=0;i<3;i++)
{
printf("%s %s %d %d %d",student[i].a,student[i].b,student[i].c,student[i].d,student[i].e);
printf("\n");
}
}
int main()
{
struct students student[3];
G(student);
j(student);
put(student);
return 0;
}