本文整理汇总了C++中Patron::getCheckedOutBooks方法的典型用法代码示例。如果您正苦于以下问题:C++ Patron::getCheckedOutBooks方法的具体用法?C++ Patron::getCheckedOutBooks怎么用?C++ Patron::getCheckedOutBooks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patron
的用法示例。
在下文中一共展示了Patron::getCheckedOutBooks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viewPatronInfo
//Same as above. Uses viewBookInfo to print books checked out to a patron.
void Library::viewPatronInfo(std::string patronID)
{
Patron* patron = GetPatron(patronID);
if(patron == NULL)
{
std::cout << std::endl << "That patron does not exist!" << std::endl;
}
else
{
std::cout << std::endl << "Patron ID: " << patron->getIdNum() << std::endl;
std::cout << "Name: " << patron->getName() << std::endl;
std::cout << "Fines: $" << std::setprecision(2) << std::fixed << patron->getFineAmount() << std::endl;
if(patron->getCheckedOutBooks().size() == 0)
{
std::cout << "No checked out books." << std::endl << std::endl;
}
else
{
std::cout << "Checked out books:" << std::endl << std::endl;
for(int i = 0; i < patron->getCheckedOutBooks().size(); i++)
{
viewBookInfo(patron->getCheckedOutBooks().at(i)->getIdCode());
}
std::cout << std::endl << std::endl;
}
}
}
示例2: incrementCurrentDate
/*******************************************************
**incrementCurrentDate Description:
** increment current date; increase each Patron's fines
** by 10 cents for each overdue Book they have
** checked out (using amendFine)
** If a book is checked out on day 0, then on day 1,
** the patron has had it for 1 day. On day 21, the
** patron has had it for 21 days, so it is still not
** overdue. On day 22, the book is overdue and
** fines will be charged.
*******************************************************/
void Library::incrementCurrentDate()
{
//increment currentDate first//
currentDate++;
//loop through Patrons//
for (unsigned int pIndex = 0; pIndex < members.size(); pIndex++)
{
//set local pointer and vector only if the//
//Patron has at least one Book checked out//
if (members[pIndex]->getCheckedOutBooks().size() > 0)
{
Patron* pPtr = members[pIndex];
vector<Book*> bVector = pPtr->getCheckedOutBooks();
//loop through Patron's checkedOut Books//
for (unsigned int bIndex = 0; bIndex < bVector.size(); bIndex++)
{
//initiate local variables//
int date = bVector[bIndex]->getDateCheckedOut();
int chOutDate = bVector[bIndex]->getCheckOutLength();
//add fine if Book is overdue//
if (currentDate > chOutDate + date)
pPtr->amendFine(.10);
}
}
}
}