?? operate.h
字號:
Status Operate(int j)
{
int flag,x;
Result V;
if(j==0)
{
cout<<"退出本系統(tǒng)"<<endl;
return OK;
}
else
{
cout<<"輸入書號:";
cin>>x;cout<<endl;
V=SearchBTree(T,x);
switch(j){
case 1:
cout<<"新書入庫"<<endl;
if(V.tag==1)
{
V.pt->recptr[V.i]->total+=A;
V.pt->recptr[V.i]->now+=A;
}
else
{
Record *r;
r=new Record;
r->num=x;
r->now=A;
r->total=A;
r->next=NULL;
InsertBTree(T,x,r,V.pt,V.i);
}
Print(T,40);
break;
case 2:
cout<<"清書出庫"<<endl;
if(V.tag==0)
{
cout<<endl<<"=========================================================================="<<endl<<endl;
cout<<"書庫沒有這種書,請?jiān)俅芜x擇操作"<<endl;
}
else
DeleteBTree(T,x,V.pt->recptr[V.i],V.pt,V.i);
Print(T,40);
break;
case 3:
if(V.tag==1)
{
if(V.pt->recptr[V.i]->now>0)
{
Lender *L1,*L2;
L1=new Lender;
L1->next=NULL;
cout<<"借者書證號:";
cin>>L1->card;cout<<endl;
cout<<"歸還日期:";
cin>>L1->time;cout<<endl;
if(V.pt->recptr[V.i]->next==NULL)
V.pt->recptr[V.i]->next=L1;
else
{
L2=V.pt->recptr[V.i]->next;
while(L2->next!=NULL)
L2=L2->next;
L2->next=L1;
}
cout<<"借出"<<x<<"號書一本"<<endl<<endl;
V.pt->recptr[V.i]->now-=1;
}
else
cout<<"此種書已借完"<<endl<<endl;
}
else
cout<<"沒有這種書"<<endl<<endl;
break;
case 4:
if(V.tag==1&&V.pt->recptr[V.i]->now<V.pt->recptr[V.i]->total)
{
Lender *L1,*L2;
char cards[20];
L1=V.pt->recptr[V.i]->next;
cout<<"還書者書證號:";
cin>>cards;
cout<<endl;
while(L1!=NULL)
{
L2=L1;
if(!strcmp(L1->card,cards))
{
L2->next=L1->next;
cout<<"還"<<x<<"號書一本"<<endl;
V.pt->recptr[V.i]->now+=1;
break;
}
else
L1=L1->next;
}
if(L1==NULL)cout<<"輸入有誤"<<endl<<endl;//書證號與所借的書不匹配
}
else
cout<<"輸入有錯(cuò)"<<endl<<endl; //書庫中不存在此類書
break;
default:break;
}
cout<<endl<<"=========================================================================="<<endl<<endl;
cout<<"請選擇下一步操作"<<endl<<endl;
cout<<"flag:";
cin>>flag;
cout<<endl;
Operate(flag);return OK;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -