//--------------------------------------------------------- // Proj1.C CMSC 341 Fall 2003 // // Driver program for project 1, CMSC 341, Fall 2003 // // // This file is to be use as-is; without changes. //------------------------------------------------------------ #include #include "BigInt.H" #include "Rational.H" #include "Number.H" #include "Proj1_aux.H" using namespace std; int main (int argc, char *argv[]) { bool bigint = false, rational = false; ifstream commands; // Parse the command line. Function exits for invalid command line. // Determine whether the command file contains BigInts or Rationals. // Open the command file. getCmdLine(argc, argv, bigint, rational, commands); // Create the appropriate kind of Number and process commands. // Note that you must use n1 and n2 inside the routine for processing // commands when reading numbers from the command file. if (bigint) { Number n1, n2; processCommands(commands, n1, n2); } else if (rational) { Number n1, n2; processCommands(commands, n1, n2); } else { cerr << "Invalid command line\n"; } if (commands.is_open()) commands.close(); }