怎么会syntax error : missing ';' before 'type'呢
各位高手,小弟初学c语言,程序调了一下午,还是不知道错在哪,老是syntax error : missing ';' before 'type',还请大家帮忙!还有希望高手说下导致syntax error : missing ';' before 'type'的常见原因;
#include<stdio.h>
#include <stdlib.h>
int search(int year,int month,int day)
{
int pr(int year);
int sum;
int sum1;
int sum2;
int i;
int count1=0;
int count2=0;
int a[4]={0};
enum week{sun=0,mon,tue,wed,thu,fri,sta};
enum week weekday;
if(year<2010)
{
for(i=year+1;i<2010;i++)
if(pr(year))
count1++;
else
count2++;
sum1=366*count1+365*count2;
for(i=12;i>=month;i--)
{
switch(i)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:a[0]++;break;
case 4:
case 6:
case 9:
case 11:a[1]++;break;
case 2:
if(pr(year))
{
a[2]++;
break;
}
else
{
a[3]++;
break;
}
}
}
sum2=a[0]*31+a[1]*30+a[2]*29+a[3]*28;
sum=sum1+sum2-day+1;
}
else
{
for(i=2010;i<year;i++)
if(pr(year))
count1++;
else
count2++;
sum1=366*count1+365*count2;
for(i=1;i<month;i++)
{
switch(i)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:a[0]++;
break;
case 4:
case 6:
case 9:
case 11:a[1]++;
break;
case 2:
if(pr(year))
{
a[2]++;break;
}
else
{
a[3]++;break;
}
}
sum2=a[0]*31+a[1]*30+a[2]*29+a[3]*28;
sum=sum1+sum2+day;
}
return sum%7;
}
int main()
{
int search(int year,int month,int day);
int year,month,day;
int n,q;
printf("请输入您所具体到的年份:");
scanf("%d %d %d",&year,&month,&day);
n = 0;
if(search(year,month,day))
n = search(year,month,day);
if(year<2010)
{
if(n+2>7)
q=12-n;
else
q=5-n;
}
else
{
if(n+5>7)
q=n-2-1;
else
q=n+5;
}
weekday=(enum week)q;
printf("这个日期是:");
switch(weekday)
{
case sun:printf("Sunday");
break;
case mon:printf("Monday");
break;
case tue:printf("Tuesday");
break;
case wed:printf("Wednesday");
break;
case thu:printf("Thursday");
break;
case fri:printf("Friday");
break;
case sta:printf("Saturday");
break;
}
return 0;
}
int pr(int year)
{
int leap=0;
if(year%4==0&&year%100!=0||year%400==0)
leap=1;
return leap;
}
真诚请教,在线等待,谢!