本文整理汇总了C++中BTREE::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ BTREE::insert方法的具体用法?C++ BTREE::insert怎么用?C++ BTREE::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTREE
的用法示例。
在下文中一共展示了BTREE::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: repCost
/*
The repCost function should display a report that lists the following
information on all books in the inventory: title, ISBN number,
quantity on hand, and wholesale cost. The list should be sorted by
wholesale cost in descending order (the books of the greatest unit
cost listed first). The report should display an appropriate title.
The function should fill the screen with information and then ask
the user to press a key to continue to the next screen.
checked
*/
void BookCollection::repCost()
{
// To hold the position of the found book
std::list<BookData>::iterator pos = bookList.begin();
// display title
std::cout << std::endl;
std::cout << "\tWholeSale Cost Report" << std::endl;
std::cout << "----------------------------------" << std::endl;
std::cout << std::endl;
//// Sort the array
//sortByWholeSale();
// create a new tree
BTREE treeWS;
for (unsigned int index = 0; index < bookList.size(); index++)
{
// std::cout << std::left << std::setw(WIDTH) << "Title: "
// << pos->getTitle() << std::endl;
// std::cout << std::left << std::setw(WIDTH) << "Isbn: "
// << pos->getIsbn() << std::endl;
// std::cout << std::left << std::setw(WIDTH) << "Quantity: "
// << pos->getQuantity() << std::endl;
// std::cout << std::fixed << std::showpoint
// << std::setprecision(2);
// std::cout << std::left << std::setw(WIDTH)
// << "Wholesale Cost: " << "$"
// << pos->getWholesaleCost() << std::endl;
// std::cout << std::endl;
// add elements to it
treeWS.insert(pos);
pos++;
// // Use for not windows
// std::cout << "Press ENTER twice to continue";
// std::cout << std::flush;
// std::cin.get();
// std::cin.clear();
// std::cin.ignore(80, '\n');
// //// use for windows
// //system("PAUSE");
} // end for
// display the tree
treeWS.inorder();
std::cout << "----------------------------------" << std::endl;
std::cout << std::endl;
} // end function repCost