qq_陌唯影_0
2015-07-14 20:30
#include <stdio.h> int main() { int year = 2008; int month = 8; int day = 8; #include <stdio.h> int main() { int year = 2008; int month = 8; int day = 8; int n=0; int k; switch(month) { case 12:n+=30; case 11:n+=31; case 10:n+=30; case 9:n+=31; case 8:n+=31; case 7:n+=30; case 6:n+=31; case 5:n+=30; case 4:n+=31; case 3:n+=28; case 2:n+=31; case 1:n+=0; break; default :printf("查无此月");break; } n+=day; if(year%400==0||(year%4==0&&year%100!=0)) k=1; else k=0; if(month>2) n=n+k; printf("%d年%d月%d日是该年的第%d天",year,month,day,n); return 0; }
#include <stdio.h> int main() { int year = 2008; int month = 8; int day = 8;
这段代码重复了,删掉。
19行:case 10:n+=30; 28行:case 1:n+=0; 29行:break;
把分号改成英文分号即可。
恩恩,谢谢回答
C语言入门
926021 学习 · 20793 问题
相似问题