为什么结构体调用多了一个car调用就会出现错误,把car所用到的if语句隐藏就没错误了
lendcount() {
FILE *fp,*fp2;
int i,n;
fp=fopen("student.txt","r");
fp2=fopen("car.txt","r");
for(i=0;fread(&student[i],sizeof(struct student),1,fp)!=0;i++)
{
//if(&car[i].cartype==学生||&car[i].cartype==研究生)
{
if(student[i].mouth!=12)
{printf("卡号:%d 借出的书籍:%s 到期时间:%d年%d月%d日\n",student[i].carnum,student[i].lendbook,student[i].year,student[i].mouth+1,student[i].day); }
else
{printf("卡号:%d 借出的书籍:%s 到期时间:%d年%d月%d日\n",student[i].carnum,student[i].lendbook,student[i].year+1,student[i].mouth-11,student[i].day);}
}
//if(&car[i].cartype==老师)
{
if(student[i].mouth==11||student[i].mouth==12)
{printf("卡号:%d 借出的书籍:%s 到期时间:%d年%d月%d日\n",student[i].carnum,student[i].lendbook,student[i].year+1,student[i].mouth-10,student[i].day); }
else
{printf("卡号:%d 借出的书籍:%s 到期时间:%d年%d月%d日\n",student[i].carnum,student[i].lendbook,student[i].year,student[i].mouth+2,student[i].day); }
}
//n=n+1;
}
fclose(fp);
//printf("目前共有%d本书借出\n",n);
printf("按任意键\n");
getch();
}