百度解决不了我的问题,求大神帮忙解答。谢谢。
/*-------------按作者查询----------*/1void query_on_author()
{
FILE *fp;
2 int i,n;
3 char ch;
4 char str[25];
if((fp=fopen("e:\\book.dat","r"))==NULL)
{
printf("open file error!\n");
exit(0);
}
for(i=0;fread(&book[i],sizeof(BOOK),1,fp)!=0;i++);
do
{
printf("please input the author:");
scanf("%s",str);
for(n=0;n<i;n++)
{
if(strcmp(book[n].author,str)==0)
{
printf("already found!\n");
printf("the book information is :\n");
printf("serialnum:%-20sbookname%-110sauthor%-35snum%d\n","serialnum","bookname","author","num");
}
else
{
printf("there is no book record in file!\n");
printf("do you want to enter again?(yes-y,no-n)\n");
getchar();
ch=getchar();
break;
}
}
}while(ch=='y'||ch=='Y');
fclose(fp);
}
出现的问题是
1.: error C2143: syntax error : missing ';' before 'type'
2.: error C2143: syntax error : missing ';' before 'type'
3.: error C2143: syntax error : missing ';' before 'type'
4.:error C2143: syntax error : missing ';' before 'type'
百度是说定义要都放在前面,我已经都放到前面了,为什么还有这个问题???
求大神解答。谢谢。