谁能检查一下下面程序的错误在哪里啊
这是代码
#include <stdio.h>
int leap(int year )
{
return ((year %4 == 0) && (year % 100 != 0)
|| (year % 400 == 0));
}
void show(int year,int month)
{
const char month_str[][4]={ "Jan","Feb","Mar","Apl",
"May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
const int month_day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i;
int j;
int wdays;
int mdays;
int days;
int m;
while(i<year)
{ i=1;
days=0;
if(leap(i))
{
days += 366;
}
else
{
days += 365;
}
i++;
}
while (i<month)
{i=1;
if(i==2 && leap(year))
{
days+=29;
}
else
{
days+=month_day[i];
}
i++;
}
printf(" %s (%d)\n",month_str[month-1],year);
printf(" Mon Tue Wed Thu Fri Sat Sun\n");
m=days/7-(int)days/7;
wdays=7*m ;
while(j<wdays)
{ j=0;
printf("%4c",' ');
j++;
}
if(month == 2 && leap(year))
{
mdays=29;
}
else
{
mdays= month_day[month];
}
while(i<=mdays)
{ i=1;
if( i > 1 && days % 7 == 0 )
{
printf("\n");
}
printf("%4d",i);
i++;
days=days+1;
}
printf("\n---------------------------\n");
}
main()
{
int year,month;
printf("输入年和月份:");
scanf("%d%d",&year,&month);
show(year,month);
}
main()
{
int year;
int month;
printf("输入年和月份:");
scanf("%d%d",&year,&month);
show(year,month);
}