1

#include<stdio.h>
struct student{
    int age;
    char name[10];
};
int main(void)
{
int i,index,j,n;
struct student students[3],temp;
for(i=0;i<=3;i++){
scanf("%d\t %s\t",&students[i].age,&students[i].name);
}
for(i=0;i<n-1;i++){
    index=i;
    for(j=i+1;j<n;j++)
        if(students[j].age<students[index].age)
            index=j;
        temp=students[index];
        students[index]=students[i];
        students[i]=temp;
}
for(i=1;i<=4;i++){
printf("%d%s\n",students[i].age,students[i].name);
}
return 0;
}

 

posted @ 2013-11-21 09:52  吕鼎鼎19950427  阅读(106)  评论(0编辑  收藏  举报