Hi guys the problem I'm having is declaring the operand "op". How do you do that?

#include <iostream>
#include <stdlib.h>
using std::cin;
using std::cout;
using std::endl;

#include "expression.h" // include definition of class Calculator

// function main begins program execution
int main()

        // print header for Calculator inventory display
        cout << "SuperCalculator at your service!" << endl;
        cout << "-----" << endl;

        // create Calculator object
        Calculator calculator;

        do{
            // initialize calculator
            static double  accumulator = 0;
            double  input = 0;
            char    operation = '+';

        // begin loop
        do{
                // get inputs from user and begin calculations
                cout << "Input: ";
                cin >> input;

        calculator.setCalculatorProcessing( accumulator, input, operation );

        cout << "Operation: ";
                cin >> operation;

        }while( operation !='!' && operation !='=');    // stops getting input and prdoubles total once "!=" condition is met

        // print data stored in object
        calculator.printTotal();

        int op;

        }while( op!='!' );  // exits only if condition is met, otherwise repeats loop
         cout << "SuperCalculator Off!" << endl;
         system ( "PAUSE" ); // pause terminal window and wait for keypress
         return 0; // indicate successful termination
 }       // end main

Since you are comparing op to '!' is there any particular reason you declared it as int rather than char?

commented: i know it should be declared as char but when declared as char it says that i need to declare op. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.