// Project Identifier: C0F4DFE8B340D81183C208F70F9D2D797908754D #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "functions.h" using namespace std; int main(int argc, char** argv){ ios_base::sync_with_stdio(false); // you should already have this cin >> std::boolalpha; // add these two lines cout << std::boolalpha; // SET PROGRAM // process command line Silly silly; process_cmd_line(argc, argv, silly); // create table map unordered_map table_map; //initialize strings string cmd = ""; string junk = ""; string argument = ""; char command = ' '; cout << "% "; while(cin >> cmd){ if (cin.fail()) { cerr << "Error: Reading from cin has failed" << endl; cin.clear(); exit(1); } command = set_command(cmd); switch(command){ case 'c': create_table(argument, table_map); break; case 'i': insert_into(argument, table_map); break; //delete from case 'd': delete_rows(argument, table_map); break; //generate index case 'g': generate_index(argument, table_map); break; //print case 'p': print_rows(argument, table_map, silly); break; //join case 'j': join_tables(argument, table_map, silly); break; //remove case 'r': remove_table(argument, table_map); break; //comment case 'y': cin.ignore(256, '\n'); break; case 'q': cout << "Thanks for being silly!\n"; table_map.clear(); cin.clear(); return 0; case 'z': cout << "Error: unrecognized command\n"; cin.ignore(256, '\n'); default: break; } cout << "% "; } return 0; }