C语言的一个问题,为什么编译错#include void main(){int month,year,days; printf("input month,year:");scanf("%d%d",&month,&year); if (month == 1 || month == 3 || month == 5|| month == 7 || month == 8 || month == 10 || month == 12 ||

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 21:45:36
C语言的一个问题,为什么编译错#includevoidmain(){intmonth,year,days;printf("inputmonth,year:");scanf("%d%d",&mont

C语言的一个问题,为什么编译错#include void main(){int month,year,days; printf("input month,year:");scanf("%d%d",&month,&year); if (month == 1 || month == 3 || month == 5|| month == 7 || month == 8 || month == 10 || month == 12 ||
C语言的一个问题,为什么编译错
#include
void main()
{
int month,year,days;
printf("input month,year:");
scanf("%d%d",&month,&year);
if (month == 1 || month == 3 || month == 5|| month == 7 || month == 8 || month == 10 || month == 12 || month == 4 || month == 6 || month == 9 || month == 11)
{
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
{
days = 31;
}
else
{
days = 30;
}
}
else
{
if (year%4 = 0 && year%100! = 0 || year%400 = 0)
{
days = 29;
}
else
{
days = 28;
}
}
printf("%d year %d month is %d days",month,year,days);
}

C语言的一个问题,为什么编译错#include void main(){int month,year,days; printf("input month,year:");scanf("%d%d",&month,&year); if (month == 1 || month == 3 || month == 5|| month == 7 || month == 8 || month == 10 || month == 12 ||
if (year%4 = 0 && year%100! = 0 || year%400 = 0)
需要用“==”,而不是“=”