新手上路,出现错误,求解?!!!!!
#include<stdio.h>int H (int x,int y)
{
int i=1,k=0,sum,b,a;
do
{
if(i%100==0)
k=k+1;
else
{
if(i%4==0)
k=k+1;
else
i=i+1;
}
}
while(i<x);
if(x%100==0)
{
sum=366*i+365*(x-1)+1;
switch(y)
{
case(1): b=sum%7; return(b);
case(2): a=sum+(y-1)*31; b=a%7; return(b);
case(3): a=sum+(y-1)*31+29; b=a%7; return(b);
case(4): a=sum+(y-2)*31+29; b=a%7; return(b);
case(5): a=sum+(y-3)*31+(y-4)*30+29; b=a%7; return(b);
case(6): a=sum+(y-3)*31+(y-5)*30+29; b=a%7; return(b);
case(7): a=sum+(y-4)*31+(y-5)*30+29; b=a%7; return(b);
case(8): a=sum+(y-4)*31+(y-6)*30+29; b=a%7; return(b);
case(9): a=sum+(y-4)*31+(y-7)*30+29; b=a%7; return(b);
case(10): a=sum+(y-5)*31+(y-7)*30+29; b=a%7; return(b);
case(11): a=sum+(y-5)*31+(y-8)*30+29; b=a%7; return(b);
case(12): a=sum+(y-6)*31+(y-8)*30+29; b=a%7; return(b);
}
}
else
{
if(x%4==0)
{
sum=366*i+365*(x-1)+1;
switch(y)
{
case(1): b=sum%7; return(b);
case(2): a=sum+(y-1)*31; b=a%7; return(b);
case(3): a=sum+(y-1)*31+29; b=a%7; return(b);
case(4): a=sum+(y-2)*31+29; b=a%7; return(b);
case(5): a=sum+(y-3)*31+(y-4)*30+29; b=a%7; return(b);
case(6): a=sum+(y-3)*31+(y-5)*30+29; b=a%7; return(b);
case(7): a=sum+(y-4)*31+(y-5)*30+29; b=a%7; return(b);
case(8): a=sum+(y-4)*31+(y-6)*30+29; b=a%7; return(b);
case(9): a=sum+(y-4)*31+(y-7)*30+29; b=a%7; return(b);
case(10): a=sum+(y-5)*31+(y-7)*30+29; b=a%7; return(b);
case(11): a=sum+(y-5)*31+(y-8)*30+29; b=a%7; return(b);
case(12): a=sum+(y-6)*31+(y-8)*30+29; b=a%7; return(b);
}
}
else
{
sum=366*i+365*(x-1)+1;
switch(y)
{
case(1): b=sum%7; return(b);
case(2): a=sum+(y-1)*28; b=a%7; return(b);
case(3): a=sum+(y-1)*31+28; b=a%7; return(b);
case(4): a=sum+(y-2)*31+28; b=a%7; return(b);
case(5): a=sum+(y-3)*31+(y-4)*30+28; b=a%7; return(b);
case(6): a=sum+(y-3)*31+(y-5)*30+28; b=a%7; return(b);
case(7): a=sum+(y-4)*31+(y-5)*30+28; b=a%7; return(b);
case(8): a=sum+(y-4)*31+(y-6)*30+28; b=a%7; return(b);
case(9): a=sum+(y-4)*31+(y-7)*30+28; b=a%7; return(b);
case(10): a=sum+(y-5)*31+(y-7)*30+28; b=a%7; return(b);
case(11): a=sum+(y-5)*31+(y-8)*30+28; b=a%7; return(b);
case(12): a=sum+(y-6)*31+(y-8)*30+28; b=a%7; return(b);
}
}
}
main();
{
int a,b,c,k,j,f,d;
printf("请输入年份");
scanf("%d",&a);
printf("请输入月份");
scanf("%d",&b);
if(a%100==0)
{
switch(b)
{
case(1): d=31;
case(2): d=29;
case(3): d=31;
case(4): d=30;
case(5): d=31;
case(6): d=30;
case(7): d=31;
case(8): d=31;
case(9): d=30;
case(10): d=31;
case(11): d=30;
case(12): d=31;
}
}
else
{
if(a%4==0)
switch(b)
{
case(1): d=31;
case(2): d=29;
case(3): d=31;
case(4): d=30;
case(5): d=31;
case(6): d=30;
case(7): d=31;
case(8): d=31;
case(9): d=30;
case(10): d=31;
case(11): d=30;
case(12): d=31;
}
else
switch(b)
{
case(1): d=31;
case(2): d=28;
case(3): d=31;
case(4): d=30;
case(5): d=31;
case(6): d=30;
case(7): d=31;
case(8): d=31;
case(9): d=30;
case(10): d=31;
case(11): d=30;
case(12): d=31;
}
}
printf("_____________________________________________________");
printf(" 星期一 星期二 星期三 星期四 星期五 星期六 星期日");
c=H(a,b);
for(k=1;k<=7*c-1;k++)
printf(" ");
for(j=1;j<=d;j++)
{
printf("%d",j);
for(f=1;f<=6;f++)
printf(" ");
if(7*a-1+6*(j-1)+3==51)
printf("\n");
}
printf("_____________________________________________________");
}
出现一下错误:
C:\Users\lenovo\Desktop\a.c(153) : fatal error C1004: unexpected end of file found
新手学程序,希望高手指教。