背景:给定某一日期,要求输出该日期下一天的日期。
int year = 0, month = 0, day = 0;
day++;
day++;
int m[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//闰年判断并修改月份天数上限
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
{
m[2]++;
}
明日日期判断
if (day > m[month])
{
day = 1;
month++;
}
if (month > 12)
{
month = 1;
year++;
}