计算日期

时间:2014-05-13 23:07:36   收藏:0   阅读:294
#include<iostream>
using namespace std;
int Monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
int N;
cin>>N;
while(N--)
{
	int year,month,day;
	cin>>year>>month>>day;
	int result=0;
	for(int i=0;i<=month-2;i++)
	{
		result+=Monthday[i];
	}
	result+=day;
	if((year%4==0&&year%100!=0)||year%400==0)
	{
		if(month>2)
			result++;

	}
	cout<<result<<endl;
}
}
计算润年

计算日期,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!