#include
typedef struct date{
unsigned int year;
unsigned int month;
unsigned int day;
}date;
int main()
{
date birthDay,now;
int age;
printf("date format is xxxx-xx-xx,such as 1993-01-01\n");
printf("input birthday\n");
scanf("%d-%d-%d", &birthDay.year , &birthDay.month , &birthDay.day);
printf("input current date\n");
scanf("%d-%d-%d",&now.year,&now.month,&now.day);
age = now.year - birthDay.year;
printf("age:%d\n", age);
return 0;
}
调用系统时间啊