标签:pre pac mes += include while main div ret
#include<iostream> using namespace std; int month1[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; int month2[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 }; bool isRYear(int yy) { if ((yy % 4 == 0 && yy % 100 != 0) || (yy % 400 == 0)) { return true; } else return false; } int main() { int yy, mm, dd; while (scanf_s("%d/%d/%d", &yy, &mm, &dd) != EOF) { int sum = 0; if (isRYear(yy)) { for (int i = 0;i < mm - 1;i++) { sum += month2[i]; } cout << sum + dd << endl; } else { for (int i = 0;i < mm - 1;i++) { sum += month1[i]; } cout << sum + dd << endl; } } return 0; }
标签:pre pac mes += include while main div ret
原文地址:https://www.cnblogs.com/Mered1th/p/10556038.html