Description
编写一个日期类,要求按xxxx-xx-xx 的格式输出日期,实现加一天的操作。
Input
输入第一行表示测试用例的个数m,接下来m行每行有3个用空格隔开的整数,分别表示年月日。测试数据不会有闰年。
Output
输出m行。按xxxx-xx-xx的格式输出,表示输入日期的后一天的日期。
Sample Input
2
1999 10 20
2001 1 31
Sample Output
1999-10-21
2001-02-01
HINT
注意个位数日期前面要有0。
#include<cstdio>
bool isLeap(int year){//判断是否是闰年
return (year%100!=0&&year%4==0||year%400==0);
}
int main(){
int year,month,day,m;
int M[13][2]={
{0,0},{31,31},{28,29},{31,31},{30,30},{31,31},{30,30},{31,31},{31,31},{30,30},{31,31},{30,30},{31,31}};//平年和闰年每个月满的天数
scanf("%d",&m);
while(m--){
scanf("%d %d %d",&