So i know a little bit of basic c++, but i am new to object oriented programming.
My task is to make a class that does calculations with +,-,*,/
i need to modify this code:
1 2 3 4 5 6 7 8
class Calc {
private:
int op1;
int op2;
public:
...
double eval (char op);
};
i have to make it using set and get methods.
any suggestion would be appreciated, also i need to know what to write in the main() function,
i need to know what to write in the main() function,
So think about what you need to do:
- Ask the user the value of op1
- Ask the user the value of op2
- Ask the user for the operator (+,-,*,/)
- Call your setters for op1 and op2.
- Call eval with the operator.
- Display the result.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.