//--------------------------------------------------------- // Proj1.C CMSC 341 Fall 2001 // // Driver program for project 1, CMSC 341, Fall 2001 // // This program uses objects and calls functions provided // by the student to simulate trucks delivering goods. // Two types of goods are supported -- perishable goods and // equipment. Command line arguments specify the type of // goods to deliver and the file name with the trucks "commands" // // Truck command file format depends on type of goods // being delivered. // // This file is to be use as is; without changes //------------------------------------------------------------ #include #include "Perishable.H" #include "Equipment.H" #include "Truck.H" #include "Proj1_aux.H" int main (int argc, char *argv[]) { bool perishable = false, equipment = false; ifstream truckCmds; // parse command line -- function exits for invalid command line // determine what type of goods to deliver and open // the file that contains the "commands" for the truck getCmdLine (argc, argv, perishable, equipment, truckCmds); // create the appropriate kind of truck and // process the file of truck commands if (perishable) { Truck truck; deliverPerishableGoods (truck, truckCmds); } else if (equipment) { Truck truck; deliverEquipment (truck, truckCmds); } else { cerr << "No goods to deliver" << endl; } }