...当前的日期(年:y1、月:m1、日:d1);输出实足年龄.

发布网友

我来回答

2个回答

热心网友

main()
{
int nCsn,nCsy,nCsr,nDqn,nDqy,nDqr;
printf("输入出生日期:年,月,日\n");
scanf("%d,%d,%d",&nCsn,&nCsy,&nCsr);
printf("输入当前日期:年,月,日\n");
scanf("%d,%d,%d",&nDqn,&nDqy,&nDqr);
if(nCsy<=nDqy)
if(nCsr<=nDqr)
printf("实际年龄是%d岁\n",nDqn-nCsn);
else
printf("实际年龄是%d岁\n",nDqn-nCsn-1);
else
printf("实际年龄是%d岁\n",nDqn-nCsn-1);
return 0;
}

热心网友

#include <stdio.h>
void main()
{
int year,month,date;
int year_i,month_i,date_i;
printf("please input the year month and date:");
scanf("%d%d%d",&year,&month,&date);
printf("please input the time with now:");
scanf("%d%d%d",&year_i,&month_i,&date_i);
printf("year with now is %d年\t%d月\t%d日\nthe input time is %d年\t%d月\t%d日\n",year_i,month_i,date_i,year,month,date);
printf("the age is %d岁\n",year_i-year);
}

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com