weixin_慕函数4379871
2019-09-11 12:33
#include <stdio.h>
int main()
{ int sum;
int year = 2008;
int month = 8;
int day = 8;
int month1 =31, month3=31, month4 =30,mouth5=31,mouth6=30,
month7=31, month8=31, month9=30,month10=31, month11=30;
if(year%4==0)
{ int month2=29;}
else
{ int month2=28;}
int moutha=month-1;
switch(montha)
{case 1:sum=month1;
break;
case 2:sum=month1+month2;
break;
case 3:sum=month1+month2+month3;
break;
case 4:sum=month1+month2+month3+month4;
break;
case 5:sum=month1+month2+month3+month4+month5;
break;
case 6:sum=month1+month2+month3+month4+month5+month6;
break;
case 7:sum=month1+month2+month3+month4+month5+month6
+month7;
break;
case 8:sum=month1+month2+month3+month4+month5+month6
+month7+month8;
break;
case 9:sum=month1+month2+month3+month4+month5+month6
+month7+month8+month9;
break;
case 10:sum=month1+month2+month3+month4+month5+month6
+month7+month8+month9+month10;
break;
case 11:sum= month1+month2+month3+month4+month5+month6
+month7+month8+month9+month10+mounth11;
break;
default:
break;
}
sum=sum+day;
printf("d%年d%月d%日是该年的第d%天",year,mouth,day,sum);
return 0;
}
就是month1那些为解释就是定义
其次
'mouth' undeclared
打错了在使用前一定要定义并且加了数字就是另一个新的同样需要定义
你不看错误提示的吗?
'montha' undeclared
'month2' undeclared
'month5' undeclared
'month6' undeclared
'mounth11' undeclared
'mouth' undeclared
C语言入门
926210 学习 · 20797 问题
相似问题