谢谢,帮我
为什么不能运行void borrow() //借阅图书
{
if(borrowb>=Maxb)
throw "error";
int x=Maxb-borrowb;
cout<<endl;
cout<<"你还能借"<<x<<"本图书"<<endl;
cout<<endl;
ifstream in("data1.txt",ios::in|ios::binary);
if(!in) cout<<"can not open file"<<endl;
for(int i=0;i<Bnum;i++)
in.read((char *)&b[i],sizeof(b[i]));
in.close();
ofstream out("data1.txt",ios::out|ios::binary);
if(!out) cout<<"can not open file"<<endl;
char *bna;
int bid;
char *auth;
char *pub;
cout<<"输入你要借的图书的信息:"<<endl;
cout<<"书名 书号 作者 出版社 "<<endl;
cin>>bna>>bid>>auth>>pub;
for( i=0;i<Bnum;i++)
{
if(b[i].BID != bid)
{
continue;
if(i==Bnum-1)
cout<<"该图书不存在或已不在架!"<<endl;
}
else
{
for(int j=i;j<Bnum-1;j++)
{b[j]=b[j+1];}
bookMax--;
Bnum--;
b[i].booknum --;
borrowb++;
cout<<"借阅成功!"<<endl;break;
if(b[i].booknum ==0)
{
for(j=0;j<Bnum;j++)
out.write((char *)&b[j],sizeof(b[j]));
out.close();
cout<<"asd";
}
}
cout<<"是否继续借书(Y/N)?"<<endl;
char z;
cin>>z;
if(z=='y'||z=='Y')
borrow();
else
exit;
}