Arsench Arsench - 1 month ago 9
C++ Question

C++ input value process as math function

I’m very new in C++ and I need your help. I want to use the input value as a mathematical function then print the result.

What i need is:


When user input: 2 +1 and hit Enter then output (cout>>)
should be your result is: 3 (the sum of 2 + 1)


The mathematical symbol could be + or * or / or -.

Could you please help me with some example?

Thanks in advance!

Answer

Search about "Reverse Polish notation" and implementation in C++