You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
499 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<bits/stdc++.h>
using namespace std;
/*判断某年是否为闰年*/
bool Runyear(int i) { //2004,2000是闰年1900不是闰年
if((i%4==0&&i%100!=0)||i%400==0)
return true;
else
return false;
}
/*统计两个年份之间的总天数*/
int count(int m,int n) {
int sumday=0;
for(; m<=n; m++) {
if(Runyear(m))
sumday+=366;
else
sumday+=365;
}
return sumday;
}
int main() {
int s=count(1901,2000);
cout<<"总天数为:"<<s<<endl;
cout<<"除7循环数"<<s/7<<endl;
cout<<"除7余数为"<<s%7<<endl;
}