|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
void main ()
{
int c, year,month,day;
printf("请输入年,月,日用,隔开\n");
scanf("%d,%d,%d",&year,&month,&day);
if (year%4==0&&year%100!=0||year%400==0)
{
if (month==1)
{
c=0+day;
printf("是第%d天\n",c);
}
else if (month==2)
{
c=31+day;
printf("是第%d天\n",c);
}
else if (month==3)
{
c=31+29+day;
printf("是第%d天\n",c);
}
else if (month==4)
{
c=31+29+31+day;
printf("是第%d天\n",c);
}
else if(month==5)
{
c=31+29+31+30+day;
printf("是第%d天\n",c);
}
else if (month==6)
{
c=31+29+31+30+31+day;
printf("是第%d天\n",c);
}
else if (month==7)
{
c=31+29+31+30+31+30+day;
printf("是第%d天\n",c);
}
else if (month==8)
{
c=31+29+31+30+31+30+31+day;
printf("是第%d天\n",c);
}
else if (month==9)
{
c=31+29+31+30+31+30+31+31+day;
printf("是第%d天\n",c);
}
else if (month==10)
{
c=31+29+31+30+31+30+31+31+30+day;
printf("是第%d天\n",c);
}
else if (month==11)
{
c=31+29+31+30+31+30+31+31+30+31+day;
printf("是第%d天\n",c);
}
else (month==12)
{
c=31+29+31+30+31+30+31+31+30+31+30+day;
printf("是第%d天\n",c);
}
}
else
{
if (month==1)
{
c=0+day;
printf("是第%d天\n",c);
}
else if (month==2)
{
c=31+day;
printf("是第%d天\n",c);
}
else if (month=3)
{
c=31+28+day;
printf("是第%d天\n",c);
}
else if (month==4)
{
c=31+28+31+day;
printf("是第%d天\n",c);
}
else if(month==5)
{
c=31+28+31+30+day;
printf("是第%d天\n",c);
}
else if (month==6)
{
c=31+28+31+30+31+day;
printf("是第%d天\n",c);
}
else if (month==7)
{
c=31+28+31+30+31+30+day;
printf("是第%d天\n",c);
}
else if (month==8)
{
c=31+28+31+30+31+30+31+day;
printf("是第%d天\n",c);
}
else if (month==9)
{
c=31+28+31+30+31+30+31+31+day;
printf("是第%d天\n",c);
}
else if (month==10)
{
c=31+28+31+30+31+30+31+31+30+day;
printf("是第%d天\n",c);
}
else if (month==11)
{
c=31+28+31+30+31+30+31+31+30+31+day;
printf("是第%d天\n",c);
}
else (month==12)
{
c=31+28+31+30+31+30+31+31+30+31+30+day;
printf("是第%d天\n",c);
}
}
}
C:\Program Files (x86)\Microsoft Visual Studio\hell wored\lianxi3\lianxi3.c(71) : error C2143: syntax error : missing ';' before '{'
C:\Program Files (x86)\Microsoft Visual Studio\hell wored\lianxi3\lianxi3.c(134) : error C2143: syntax error : missing ';' before '{'
执行 cl.exe 时出错.
lianxi3.obj - 1 error(s), 0 warning(s)
编译提示有一个错误,说”{”前面缺少”;”可是按提示看并不缺少“;”
谁给看看是怎么回事
本帖最后由 jackz007 于 2019-10-13 17:39 编辑
这句代码有错误:
else (month==12)
应该是
else if (month==12)
整个代码中有 2 处,都是错的,都得修改。
|
|