用c语言switch语句编写程序,输入某年某月,求该月的天数 判断一个日期是这一年中那一天。编译环境vc+6.0#includeusing namespace std;void main(){int i;int sum=0;int year,month,day;int rick[12]={31,29,31,30,31,30,31,31,30,31,30,31};int conmon[12]={31,28,31,30,31,30,31,31,30,31,30,31};cout请输入一个日期,格式:2010 10 10\";cin>;>;year>;>;month>;>;day;if((year%4=0&year%100。0)|(year%400=0)){for(i=0;i;i+)sum=sum+rick[i];}else{for(i=0;i;i+)sum=sum+conmon[i];}sum=sum+day;cout是这一年中的第\"天\";
题目是;编写程序 输入某年某月,求该月的天数 可是我老错,求大佬指点错在那
C语言程序设计:输入某年某月输出某月有多少天? #includevoid main(){int year,month;int month_day(int year,int month);printf(\"输入年份:\");scanf(\"%d\",&year);printf(\"输入月份:\");scanf(\"%d\",&month);printf(\"%d年%d月有%d天\",year,month,month_day(year,month));}int month_day(int year,int month){int day;switch(month){int day;case 1:case 3:case 5:case 7:case 8:case10:case 12:day=31;break;case 2:if(year%100。0&year%4=0)day=29;elseday=28;break;case 4:case 6:case 9:case 11:day=30;break;default:printf(\"输入月份不存在\");}return day;}