#include
int main()
{
int year,month,day;
int maxdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
printf("請輸入年月日,中間用空格隔開!\n");
scanf("%d %d %d",&year,&month,&day);
if(year%400==0 || (year%4==0 && year%100!=0)) maxdays[1]=29;//閏年二月最大值是29
if(month>12 || month
printf("日期不合法!\n");
return 0;
}
if(day>maxdays[month-1])
printf("日期不合法!\n");
day++;
day=1;
month++;
if(month>12)
month=1;
year++;
printf("明天的日期是:%d-%d-%d\n",year,month,day);
#include
int main()
{
int year,month,day;
int maxdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
printf("請輸入年月日,中間用空格隔開!\n");
scanf("%d %d %d",&year,&month,&day);
if(year%400==0 || (year%4==0 && year%100!=0)) maxdays[1]=29;//閏年二月最大值是29
if(month>12 || month
{
printf("日期不合法!\n");
return 0;
}
if(day>maxdays[month-1])
{
printf("日期不合法!\n");
return 0;
}
day++;
if(day>maxdays[month-1])
{
day=1;
month++;
if(month>12)
{
month=1;
year++;
}
}
printf("明天的日期是:%d-%d-%d\n",year,month,day);
return 0;
}