#include<stdio.h> struct student{ int age; char name[10]; } main(void) { int i,j,x; struct student students[50],temp; for(i=0;i<4;i++);{ scanf("%s",students[i].name); scanf("%d",&students[i].age); } for(i=0;i<3;i++){ x=i; for(j=i+1;j<4;j++) if(students[j].age<students[i].age) x=j; temp=students[x]; students[x]=students[i]; students[i]=temp; } printf("%d %s\n",students[i].age,students[i].name); return 0; }
为什么总说答案错误,太气人了。