#includeint runyearpanduan(int x) { if ((x % 4 == 0 && x % 100 != 0) || (x % 400 == 0)) { return 1; //闰年 } else { return 0;//平年 } } int main() { int year = 0; int month = 0; int days = 0; int i = 0; scanf("%d %d %d", &year,&month,&days); int runyear = 0; runyear = runyearpanduan(year); int run[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 }; int ping[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; int sum = 0; if (runyear == 1) { for (i = 0; i < month - 1; i++) { sum = sum + run[i]; } sum = sum + days; printf("%d", sum); } if (runyear == 0) { for (i = 0; i < month - 1; i++) { sum = sum + ping[i]; } sum = sum + days; printf("%d", sum); } return 0; } //英文拼音无缝切换,哈哈哈哈哈
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)