#include<stdio.h>
#define N 200
struct child
{
char name[10];
char sex[3];
int age;
int height;
float weight;
struct {
int year;
int month;
int day;
}bdate;
}ch[N];
void input()
{
int i;
for(i=0;i<N;i++)
{
printf("\n请输入第%d名小朋友信息:\n",i+1);
printf("姓名:");
scanf("%s",ch[i].name);
printf("性别:");
scanf("%s",ch[i].sex);
printf("年龄:");
scanf("%d",&ch[i].age);
printf("身高:");
scanf("%d",&ch[i].height);
printf("体重:");
scanf("%f",&ch[i].weight);
printf("出生日期[YYYY-MM-DD]:");
scanf("%d-%d-%d",&ch[i].bdate.year,&ch[i].bdate.month,&ch[i].bdate.day);
}
}
void sort()
{
struct child ct;
int i,j;
for(i=0;i<N-1;i++)
for(j=0;j<N-i-1;j++)
if(ch[j].height<ch[j+1].height)
{
ct=ch[j];
ch[j]=ch[j+1];
ch[j+1]=ct;
}
}
void output()
{
int i;
printf("\n\t幼儿园小朋友一览(依身高排序)\n");
printf("===================================================\n");
printf(" 姓名 性别 年龄 身高 体重 出生日期 \n");
printf("===================================================\n");
for(i=0;i<N;i++)
printf(" %-8s %-2s %2d %d %3.1f %d.%d.%d\n",ch[i].name,ch[i].sex,ch[i].age,ch[i].height,ch[i].weight,ch[i].bdate.year,ch[i].bdate.month,ch[i].bdate.day);
}
void main()
{
input();
sort();
output();
}