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


C++ Patron::amendFine方法代码示例

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


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

示例1: 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);
			}
		}
	}
}
开发者ID:brownnr,项目名称:C-and-Cpp,代码行数:42,代码来源:Library.cpp


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