#include<stdio.h>
struct date{
int year;
int month;
int day;
};
int main(){
struct date today;
scanf("%d%d%d" , &today.year , &today.month , &today.day );
struct date tmw;
tmw = today;
if(tmw.month == 1|3|5|7|8|10|12 ){
if( tmw.day == 31 ){
tmw.day = 1;
tmw.month++;
}else{
tmw.day++;
}
}
else if(tmw.month == 2){
if( (tmw%100!=0) && (tmw.year%400 == 0) | (tmw.year%4 == 0) ){
if(tmw.day == 29 ){
tmw.month++;
tmw.day = 1;
}else{
tme.day++;
}
}else{
if(tmw.day == 28 ){
tmw.month++;
tmw.day = 1;
}else{
tmw.day++;
}
}
}
else{
if(tmw.day == 30 ){
tmw.month++;
tmw.day = 1;
}else{
tmw.day++;
}
}
if(tmw.month == 13 ){
tmw.year++;
tmw.month = 1;
}
printf("%d%d%d" , tmw.year , tmw.month , tmw.day );
return 0;
}
输出明天的日期,结构体
于 2023-03-11 10:51:05 首次发布