//--------------------------------------------------------- // Proj1.C CMSC 341 Spring 2003 // // Driver program for project 1, CMSC 341, Spring 2003 // // // This file is to be use as-is; without changes. //------------------------------------------------------------ #include #include #include "Bag.H" #include "Proj1Aux.H" using namespace std; int main (int argc, char *argv[]) { bool strings = false, ints = false; int nrItems; ifstream commands; // Parse the command line. Function exits for invalid command line. // Determine whether the Bag contains strings or integers // Determine max number of items in the Bag // Open the command file. GetCmdLine (argc, argv, strings, ints, nrItems, commands); // Create the appropriate kind of Bag and process commands. if (strings) { Bag bag (nrItems); ProcessStringCommands(bag, commands); } else if (ints) { Bag bag(nrItems); ProcessIntCommands(bag, commands); } else { cerr << "Invalid command line\n"; } if (commands.is_open()) commands.close(); return 0; }