建立一个通讯录,通讯录的结构记录包括:姓名、生日、电话号码;其中生日又包括三项:年、月、日。
编写程序,定义一个嵌套的结构类型,输入n(n<10)个联系人的信息,再按照他们的姓名字母顺序依次输出其信息。
#include<stdio.h>
#define N 2
struct student {
int year[N] = {2001,1030};
int month[N] = {2,3};
int day[N] = {1,3};
struct sourse {
const char* name[N] = {"郁达夫","和于是"};
const char* phone[N] = {"1515484802","3731340801"};
}data;
}num[10];
int main() {
for (int i = 0; i < N; i++)
{
printf("姓名:%s ", num[i].data.name[i]);
printf("电话:%s ", num[i].data.phone[i]);
printf("出生于%d年", num[i].year[i]);
printf("%d月", num[i].month[i]);
printf("%d日\n", num[i].day[i]);
}
return 0;
}
#include<stdio.h>
typedef struct birthday {
int year;
int month;
int day;
}birthday;
typedef struct addressBook {
char *name;
birthday bir;
char *phonenum;
}addressBook;
int main(){
addressBook *book;
int i = 0;
for ()
}