虔诚请教大虾,这程序哪错了
朋友录,并按出生年顺序排列#include<stdio.h>
struct birth_list{
int year;
int month;
int day;
};
struct friends_list{
char name[10];
struct birth_list birthday;。。。。嵌套结构
char telephone[13];
};
void bubble(struct friends_list *,int);。。。调用函数冒泡排序
int main(void)
{
struct friends_list friends[10];
struct friends_list *f=friends;
int i,n;
printf("Enter n:");
scanf("%d",&n);
for(i=0;i<n;i++,f++){
printf("Enter friend imformation:");
scanf("%s%d%d%d%s",(*f).name,&(*f).birthday.year,&(*f).birthday.month,&(*f).birthday.day,(*f).telephone);。。。。。输入信息
}
bubble(f,n);
for(i=0;i<n;i++,f++){。。。。。打印结果
printf("%s",(*f).name);
}
return 0;
}
void bubble(struct friends_list *f,int n)
{
int i,j;
struct friends_list temp;
for(i=1;i<n;i++)
for(j=0;j<n-i;j++){
if(f[j].birthday.year>f[j+1].birthday.year){
temp=f[j];
f[j]=f[j+1];
f[j+1]=temp;
}
}
}