#include <stdafx.h>int main(){ int year = 2008, month = 8, day = 8, b = 0; for (; 1 <= month; month--) { switch (month) { case 1 || 3 || 5 || 7 || 8 || 10 || 12: b = b + 31; break; case 2: if (year % 4 == 0 && year % 100 !=0 || year % 400 == 0) b = b + 29; else b = b + 28; break; case 4||6||9||11: b = b + 30; break; } } printf("%d", b + day); return 0;}
1 回答
已采纳
OuBa
TA贡献6条经验 获得超5个赞
#include <stdafx.h> int main() { int year = 2008; int month = 8; int day = 8; int b = 0; for (; 1 <= month; month--) { switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: { b = b + 31; break; } case 2: { if (year % 4 == 0 && year % 100 !=0 || year % 400 == 0) { b = b + 29; } else { b = b + 28; } break; } case 4: case 6: case 9: case 11: { b = b + 30; break; } } } printf("%d\n", b + day); return 0; }
- 1 回答
- 0 关注
- 1878 浏览
添加回答
举报
0/150
提交
取消