谁能帮我看一下这个C程序?
- 提问者网友:niaiwoma
- 2021-08-10 07:46
- 五星知识达人网友:独钓一江月
- 2021-08-10 09:20
#include<stdio.h>
main()
{ <--注意大括号一一对应(1)
int day,mou,year;
printf("year and mou\n");
scanf ("%d%d",&year,&mou);
错误代码:if(mou=1||mou=3||mou=5||mou=7||mou=8||mou=10||mou=12) //赋值
更正:if(mou==1||mou==3||mou==5||mou==7||mou==8||mou==10||mou==12)//比较
day=31;
else
错误代码: if(mou=4||mou=6||mou=9||mou=11)
更正:if(mou==4||mou==6||mou==9||mou==11)
原因同上!
day=30;
else
if((year%4==0&&year%100!=0)||year%400==0)
day=29;
else
{ <--注意大括号一一对应(2)
printf("dont year!\n");
return;
} <--注意大括号一一对应(2)
printf("there are %d days in %d %d \n"),day,year,mou);
} <--注意大括号一一对应(1)
- 1楼网友:醉吻情书
- 2021-08-10 13:43
火星文?
- 2楼网友:拜訪者
- 2021-08-10 12:15
- 3楼网友:纵马山川剑自提
- 2021-08-10 11:33
- 4楼网友:酒醒三更
- 2021-08-10 10:55
#include<stdio.h> main() {int day,mou,year; printf("year and mou\n"); scanf ("%d%d",&year,&mou); if(mou==1||mou==3||mou==5||mou==7||mou==8||mou==10||mou==12)day=31; else if(mou==4||mou==6||mou==9||mou==11)day=30; else if((year%4==0&&year%100!=0)||year%400==0)day=29; else printf("dont year!\n"); return printf("there are %d days in %d %d \n",day,year,mou);}
//可以了,=是赋值啊,==才是判断啊