Hello everyone,
I'm writing a code and in there and I need to convert a char which contains any of "+", "-", "*", "/" into a real operator.
As an example let's say I have:
char myOp = '+';
int op1 = 10, op2 = 20;
cout << op1 myOp op2 << endl;
How could I do that.
Of course I know I could use "switch", but I am looking for a more professional way of doing it.("If there exist one!!!").
Thanks a lot.