本文整理汇总了C++中Table::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::addItem方法的具体用法?C++ Table::addItem怎么用?C++ Table::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::addItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_random_items
void add_random_items (std::size_t n, Table& t, Random& r)
{
while (n--)
{
shared_ptr <SHAMapItem> item (
make_random_item (r));
meets_postcondition (
t.addItem (*item, false, false));
}
}
示例2: result
void
add_random_items (std::size_t n, Table& t, beast::Random& r)
{
while (n--)
{
std::shared_ptr <SHAMapItem> item (
make_random_item (r));
auto const result (t.addItem (*item, false, false));
assert (result);
(void) result;
}
}
示例3: main
int main() {
string param1, param2;
Table gradeTable;
Table studentTable;
for (;;) {
cout << "tables> ";
cin >> param1;
//transforms user input to lowercase to accept more garbage
transform(param1.begin(), param1.end(), param1.begin(), ::tolower);
if (param1 == "students")
{
cin >> param2;
//transforms user input to lowercase to accept more garbage
transform(param1.begin(), param1.end(), param1.begin(), ::tolower);
if (param2 == "add")
{
if (studentTable.addItem(STUDENT))
cout << "item added successfully" << endl;
else
cout << "an error occured" << endl;
} else if (param2 == "delete")
{
gradeTable.deleteItem(GRADE, studentTable.deleteItem(STUDENT, USER_DEFINED_ID));
} else if (param2 == "display")
{
studentTable.displayTable();
cout << endl;
} else
{
cout << "invalid operation, param2" << endl;
}
} else if (param1 == "grades")