需要注意的是:结构体变量调用成员 使用 . 而结构体指针使用 -> 不然编译器会报错!!!
#include <stdio.h>
typedef struct{
int year;
int month;
int day;
}Data;
typedef struct{
char name[20];
int age;
Data first;
Data second;
}People;
void getpeople(People *people){
printf("请问姓名是:");
scanf("%s",people->name);
printf("请问年龄:");
scanf("%d",&people->age);
printf("请问是否接种过疫苗:");
getchar();
if(getchar()=='Y'){
printf("请输入第一针疫苗的接种日期:");
scanf("%d-%d-%d",&people->first.year,&people->first.month,&people->first.day);
printf("请问是否接种过第二针疫苗:");
getchar();
if(getchar()=='Y'){
printf("请输入第二针疫苗接种的日期:");
scanf("%d-%d-%d",&people->second.year,&people->second.month,&people->second.day);
}
else{
printf("请尽快接种第二针疫苗!\n");
people-