17-18数组作业动手0,谁能帮我看一看我哪错了啊
#include <stdio.h>int main()
{
int year,i,num = 13;
int a[] = {31,29,31,30,31,30,31,31,30,31,30,31}; //闰年
int b[] = {31,28,31,30,31,30,31,31,30,31,30,31}; //平年
printf("请输入一个年份:");
scanf("%d",&year);
if (year % 4 == 0)
{
for (i = 1,i < num,i++)
{
printf("%d月份:%d天",i,a);
}
}
else
{
for (i = 1,i < num,i++)
{
printf("%d月份:%d天",i,b);
}
}
return 0;
} if( !(year%4) && (year%100) || !(year%400) ) for()括号里的是以“;”作为分隔的,而不是‘’,‘’号;
即:for (i = 1;i < num;i++)才是正确的写法
傻眼貓咪 发表于 2021-12-27 23:26
if( !(year%4) && (year%100) || !(year%400) )
感谢回复!{:10_254:} 芒果鎏鎏 发表于 2021-12-28 21:56
感谢回复!
{:5_108:}
页:
[1]