当前位置: 首页>>代码示例>>C++>>正文


C++ Book::getIdCode方法代码示例

本文整理汇总了C++中Book::getIdCode方法的典型用法代码示例。如果您正苦于以下问题:C++ Book::getIdCode方法的具体用法?C++ Book::getIdCode怎么用?C++ Book::getIdCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Book的用法示例。


在下文中一共展示了Book::getIdCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: viewBookInfo

//Goes through the public properties of a book and prints them out.
//This will print out if a book is checked out AND who requested it, if that situation is true
void Library::viewBookInfo(std::string bookID)
{
    Book* book = GetBook(bookID);

    if(book == NULL)
    {
        std::cout << "No such holding exists." << std::endl;
    }
    else
    {
        std::cout << std::endl << "ID: " << book->getIdCode() << std::endl;
        std::cout << "Title: " << book->getTitle() << std::endl;
        std::cout << "Author: " << book->getAuthor() << std::endl;

        if(book->getLocation() == ON_SHELF)
        {
            std::cout << "Location: ON SHELF" << std::endl;
        }
        else if(book->getLocation() == ON_HOLD)
        {
            std::cout << "Location: ON HOLD" << std::endl;
            std::cout << "Requested By: " << book->getRequestedBy()->getName() << std::endl;
            std::cout << "Requested By ID: " << book->getRequestedBy()->getIdNum() << std::endl;
        }
        else
        {
            std::cout << "Location: CHECKED OUT" << std::endl;
            std::cout << "Checked out by: " << book->getCheckedOutBy()->getName() << std::endl;
            std::cout << "Checked out by ID: " << book->getCheckedOutBy()->getIdNum() << std::endl;
            std::cout << "Due date: " << book->getDateCheckedOut() + 21 << std::endl;

            if(book->getRequestedBy() != NULL)
            {
                std::cout << "This book is also requested by patron: " << book->getRequestedBy()->getIdNum()
                        << std::endl;

                std::cout << "It should be put on the hold shelf when checked back in." << std::endl;
            }
        }
    }
}
开发者ID:nathansoz,项目名称:cs161-final,代码行数:43,代码来源:Library.cpp


注:本文中的Book::getIdCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。