You are viewing a single comment's thread from:

RE: C++ Programming ( Simple Calculator Code)♦♦♦♦

in #programming8 years ago

To expand on your idea you might have to look at operator precedence and introduce a virtual stack to handle the operands and operators.

Ive used the reverse polish notation to handle converting infix to postfix for a similar calc/eval project in assembler. Using RPN allows you to specify other custom operators, like functions for string handling: concatenation, uppercase, stringtoval and logical operations and even possible including bitwise operations.

Wikipedia has a good entry on RPN using infix to postfix, and a breakdown of the steps that are used to calculate some examples: https://en.wikipedia.org/wiki/Reverse_Polish_notation

Keep up the good work