#include#include#includeusing namespace std;bool is_leap_year(int year) {if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)return true;elsereturn false;}int main(){int year1, month1, day1, year2, month2, day2;int month[13] = { 0, 31,28,31,30,31,30,31,31,30,31,30,31 };while (cin >> year1 >> month1 >> day1 >> year2 >> month2 >> day2) {if (year2 > year1 || (year2 == year1 && month2 > month1) || (year2 == year1 && month2 == month1 && day2 > day1)) {swap(year1, year2);swap(month1, month2);swap(day1, day2);}int output = 0;while (year1 - year2 > 1) {if (is_leap_year(year2))output += 366;elseoutput += 365;year2++;}output = output + day1 - day2;if (is_leap_year(year2) && month2 > 2)output++;while (year1 != year2 || month1 != month2) {if (month2 == 2) {if (is_leap_year(year2))output += 29;elseoutput += 28;month2++;continue;}output += month[month2];month2++;if (month2 == 13) {month2 = 1;year2++;}}cout << output << endl;}return 0;}
已找到錯