All pastes #709911 Raw Edit

Untitled

public text v1 · immutable
#709911 ·published 2007-09-25 02:17 UTC
rendered paste body
#include<iostream>
#include "Calculator.h"
#include<string>

using namespace std;


int main( int argc, char** argv ) {

   string cmd = "";
   double value;
   Calculator calc;

   cout << "Starting the calculator simulation\n";
   cout << "Enter the operation to be performed: ";

   while(cin) {
      cin >> cmd;

      calc.set_command(cmd);

      if(calc.is_legal_command()) {
         if(calc.is_trig_command()) {
            cout << "Enter the angle in degrees: ";
            cin >> value;
            cout << "The " << cmd << " of " << value << " is: " <<
                  calc.process(value) << endl;
         } else {
            cout << "Enter the parameter for the operation: ";
            cin >> value;
            cout << "The " << cmd << " of " << value << " is: " <<
                  calc.process(value) << endl;
         }
      } else {
         cout << cmd << " is not a legal operation!" << endl;
      }
      cout << "Enter the operation to be performed: ";
   }
   cout << "\nSimulation complete" ;

   return 0;
}