本文整理汇总了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;
}
示例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;
}