调用函数返回值出错了!怎么办?
#include <stdio.h>void panduan(int year,int month,int day);
int main ()
{
printf("---------输入年月日,计算星期几!---------\n\n\n");
while(1)
{
while(1)
{
int year,month,day;
int y,m,d,c,s,w;
int i=0;
printf("请输入年月日(示例:2016 3 15):");
scanf("%d %d %d",&year,&month,&day);
printf("\n");
y=year;m=month;d=day;
if(panduan(y,m,d))
{
printf("日期不存在!请重新输入!\n\n");break;
}
if (m==1) c=d;
else if (m==2) c=31+d;
else if (m==3) c=31+28+d;
else if (m==4) c=31+28+31+d;
else if (m==5) c=31+28+31+30+d;
else if (m==6) c=31+28+31+30+31+d;
else if (m==7) c=31+28+31+30+31+30+d;
else if (m==8) c=31+28+31+30+31+30+31+d;
else if (m==9) c=31+28+31+30+31+30+31+31+d;
else if (m==10) c=31+28+31+30+31+30+31+31+30+d;
else if (m==11) c=31+28+31+30+31+30+31+31+30+31+d;
else if (m==12) c=31+28+31+30+31+30+31+31+30+31+30+d;
if (m>2)
{if (y%100==0) {if (y%400==0) c=c+1;}
else if (y%4==0) c=c+1;}
s=(y-1)*365+(y-1)/4-(y-1)/100+(y-1)/400+c;
w=s%7;
printf("\n");
switch (w)
{
case 0: printf(" %d年%d月%d日是星期日\n",year,month,day);break;
case 1: printf(" %d年%d月%d日是星期一\n",year,month,day);break;
case 2: printf(" %d年%d月%d日是星期二\n",year,month,day);break;
case 3: printf(" %d年%d月%d日是星期三\n",year,month,day);break;
case 4: printf(" %d年%d月%d日是星期四\n",year,month,day);break;
case 5: printf(" %d年%d月%d日是星期五\n",year,month,day);break;
case 6: printf(" %d年%d月%d日是星期六\n",year,month,day);break;
}
printf("\n\n");
}
}
return 0;
}
void panduan(int year,int month,int day)
{
int i;
if(year<=0)
{
i=1;
}
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
{
if(day<=0||day>31)
{
i=1;
}
}else if(month==4||month==6||month==9||month==11)
{
if(day<=0||day>30)
{
i=1;
}
}else if(month==2)
{
if(day%4==0&&day%100!=0)
{
if(day<=0||day>29)
{
i=1;
}
}else
{
if(day<=0||day>28)
{
i=1;
}
}
}else
{
i=1;
}
return i;
}