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


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

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


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

示例1: displayBookInformation

void Utils::displayBookInformation(Book book) {
	cout << "\tISBN            \t" << book.getIsbn() << endl;
	cout << "\tTitle           \t" << book.getTitle() << endl;
	cout << "\tAuthor          \t" << book.getAuthor() << endl;
	cout << "\tPublisher       \t" << book.getPublisher() << endl;
	cout << "\tDate Added      \t" << toString(book.getDateAdded()) << endl;
	cout << "\tQuantity-On-Hand\t" << book.getQuantityOnHand() << endl;
	cout << "\tWholesale Cost  \t" << setprecision(2) << book.getWholesaleCost() << endl;
	cout << "\tRetail Price    \t" << setprecision(2) << book.getRetailPrice() << endl << endl;
}
开发者ID:hungtong,项目名称:TeamProject_CIS22B,代码行数:10,代码来源:Utils.cpp

示例2: toString

/*
Converts a Book object to string representation

Example:
1
ISBN:               0399257748
Title:				The Martian
Author:				Andy Weir
Publisher:			Scribner
Date Added:			2015-1-16 23:56:11
Quantity:			1
*/
string Utils::toString(int itemNumber, int quantity, Book book) {
	string bookString = "";
	bookString += to_string(itemNumber) + "\n";
	bookString += "\t ISBN:              " + book.getIsbn() + "\n";
	bookString += "\t Title:             " + book.getTitle() + "\n";
	bookString += "\t Author:            " + book.getAuthor() + "\n";
	bookString += "\t Publisher:         " + book.getPublisher() + "\n";
	bookString += "\t Date Added:        " + toString(book.getDateAdded()) + "\n";
	bookString += "\t Quantity:          " + to_string(quantity) + "\n";

	ostringstream stream;
	stream << fixed << setprecision(2) << book.getRetailPrice();
	bookString += "\t Retail Price:      " + stream.str() + "\n";

	return bookString;
}
开发者ID:hungtong,项目名称:TeamProject_CIS22B,代码行数:28,代码来源:Utils.cpp


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