重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
struct Date{
成都创新互联公司是专业的洛扎网站建设公司,洛扎接单;提供成都网站制作、做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行洛扎网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
int year;
int month;
int day;
};
Date * fun(Date *date){
Date today;
today.year = 2013;
today.month = 7;
today.day = 1;
Date age;
age.year = today.year - date-year;
age.month = today.month - date-month;
age.day = today.day - date-day;
return age;
}
int main(){
Date me;
me.year = 1980;
me.month = 6;
me.day = 12;
Date * age = fun(me);
printf("%d%d%d",age-year,age-month,age-day);
return 0;
}
#includestadio.h
main()
{ int year,year1,month,month1,day,day1,age;
printf("请输入您的生日:");
scanf("%d %d %d",year,month,day);
printf("请输入当前日期:");
scanf("%d %d %d",year1,month1,day1);
if(year1==year)
age=0;
else
{age=year1-year;
if(month1month||(month1==monthday1day))
age=age-1;
}
printf("您的年龄是:%d",age);
}
#include
stdio.h
void
main()
{
int
y1,m1,d1,y0,m0,d0,y,m,d;
printf("请输入当前日期\n");
printf("y1=");
scanf("%d",y1);
printf("m1=");
scanf("%d",m1);
printf("d1=");
scanf("%d",d1);
printf("请输入学生的生日\n");
printf("y0=");
scanf("%d",y0);
printf("m0=");
scanf("%d",m0);
printf("d0=");
scanf("%d",d0);
y=y1-y0;
m=m1-m0;
d=d1-d0;
printf("该学生的年龄为%d
%d
%d",y,m,d);
}
已经成功运行
祝你学业有成