Пример #1
0
void Menu::borrowPage(Readerdata *readerdata,BookDB *bookdb)
{
    int reader_num;
    int book_num;
    Reader *r;
    Book *b;
    cout <<  "***************************************************" << endl;
    cout <<  "                  借阅者编号:" ;
    cin >> reader_num;
    r = readerdata->search_rnum(reader_num);
    if (r == NULL)
    {
        cout<<"Sorry, 该借阅者不存在!"<<endl;
    }
    else
    {
        cout <<  "                  请输入所借图书编号:" ;
        cin >> book_num;
        b = bookdb->search_bnum(book_num);
        if (b == NULL)
        {
              cout<<"Sorry, 该图书不存在!"<<endl;
        }
        else
        {
            if (b->borrowbook()==0)//onshelf标志量
            {
                cout << "对不起,该图书已借出,不能借书!"<< endl;
            }
            else
            {
                r->borrowbook(book_num);
                cout << r->getrname()<<"借阅"<<"《"<<b->getbname()<<"》"<<"成功"<<endl;
            }
        }
    }
}