本文整理汇总了C++中Inventory::getQuantity方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::getQuantity方法的具体用法?C++ Inventory::getQuantity怎么用?C++ Inventory::getQuantity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::getQuantity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Test the copy constructor
*/
TEST(Inventory, CopyConstructor)
{
const Inventory i;
const Inventory i2 = i;
EXPECT_EQ(i.getSKU(), i2.getSKU());
EXPECT_EQ(i.getItemDesc(), i2.getItemDesc());
EXPECT_EQ(i.getCategoryID(), i2.getCategoryID());
EXPECT_EQ(i.getMerchantID(), i2.getMerchantID());
EXPECT_EQ(i.getPrice(), i2.getPrice());
EXPECT_EQ(i.getQuantity(), i2.getQuantity());
}
示例2: displayInventory
void displayInventory(Inventory i)
{
cout << showpoint << setprecision(2) << fixed;
cout << "Item Number: " << i.getItemNumber() << endl;
cout << "Quantity: " << i.getQuantity() << endl;
cout << "Cost: $" << i.getCost() << endl;
cout << "Total cost: $" << i.getTotalCost() << endl << endl;
}
示例3: operator
Inventory operator()(const Inventory& inv,
float discount) {
return Inventory(inv.getItem(),
inv.getQuantity(),
inv.getValue() * (1 - discount));
}
示例4: operator
void operator()(const Inventory& inv) {
quantity += inv.getQuantity();
value += inv.getQuantity() * inv.getValue();
}