c/c++[codeup 202六] - 日期问题
编写一个日期+1,要求按xxxx-xx-xx 的格式输出日期,实现加一天的操作。
输入
输入第一行表示测试用例的个数m,接下来m行每行有3个用空格隔开的整数,分别表示年月日。测试数据不会有闰年。
输出
输出m行。按xxxx-xx-xx的格式输出,表示输入日期的后一天的日期。
样例输入
2
1999 10 20
2001 1 31
样例输出
1999-10-21
2001-02-01
提示
注意个位数日期前面要有0。
#include
using namespace std;
void output(int y, int m, int d) {
if (y >= 1 && y <= 9) cout<<"000"<= 1 && m <= 9) cout<<'0'<= 1 && d <= 9) cout<<'0'<>n;
while(n--) {
cin >>y >>m >>d;
if (d < month[m]) {
d++;
output(y, m , d);
}
else {
d = 1;
m++;
if (m == 13) {
m = 1;
y++;
}
output(y, m, d);
}
}
return 0;
}
赞我JJ长5CM461