Esempio n. 1
0
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));
    }
}
Esempio n. 2
0
 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;
     }
 }
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")