我这个代码到底哪里错了呢?include <stdio.h>int main() { int year = 2008; int month = 8; int day = 8; switch(day) { case 1 : day+=31; break; case 2: if(2008%400==0||2008%4==0&&2008%100!=0) { day+=29; else day+=28; } case 3 : day+=31; break; case 4 : day+=30; break; case 5 : day+=31; break; case 6 : day+=30; break; case 7 : day+=31; break; case 8 : day+=31; break; case 9 : day+=30; break; case 10 :day+=31; break; case 11: day+=30; break; case 12: day+=31; break;}printf("2008年8月8日是第%d天");
2 回答
望远
TA贡献1017条经验 获得超1032个赞
#include <stdio.h> int main() { int year = 2008; int month = 8; int day = 8; switch(day) { case 1 : day+=31; break; case 2: if(2008%400==0||2008%4==0&&2008%100!=0) { day+=29; } else day+=28; case 3 : day+=31; break; case 4 : day+=30; break; case 5 : day+=31; break; case 6 : day+=30; break; case 7 : day+=31; break; case 8 : day+=31; break; case 9 : day+=30; break; case 10 :day+=31; break; case 11: day+=30; break; case 12: day+=31; break;} printf("2008年8月8日是第%d天\n"); }
运行结果:
- 2 回答
- 0 关注
- 1754 浏览
添加回答
举报
0/150
提交
取消