/*** Saeteurn, San ect_sfs@ecst.csuchico.edu 15b Program 5: Kwik-E-Mart Simulator ***/ #include "store.h" int main(int argc,char *argv[]) { int checkers; if(argc<4 || argc>4) { cerr << "Error: invalid number of command line arguments." << endl; return 1; } string buf = argv[1]; checkers = atoi(buf.c_str()); fstream inFile(argv[2],ios::in); fstream outFile(argv[3],ios::out); Store kwik; //Readable Files if(!inFile) { cerr << "Error: could not open input file <" << argv[2] << '>' << endl; return 1; } if(!outFile) { cerr << "Error: could not open output file <" << argv[3] << '>' << endl; return 1; } string name; string sType; bool type; int Atime; int items; while(inFile >> name)//Checks end of file { inFile >> sType; if(sType=="shopper") { type = true; } else { type = false; } inFile >> Atime; inFile >> items; kwik.insert(name,type,Atime,items,Atime); } kwik.runSimulator(outFile,checkers); }