This is a C++ project that takes a mathematical infix expression (like 2 + 3 * (4 - 1)
) and:
- Converts it to postfix (Reverse Polish Notation) format
- Evaluates the postfix expression using a stack
It's basically how calculators or compilers handle expressions behind the scenes.
- ๐ Infix โก๏ธ Postfix conversion
- ๐ง Stack-based RPN evaluation
- โ๏ธ Handles brackets and operator precedence
- โ๏ธ Uses STL (
stack
,vector
,string
) - ๐ก Modular code with clean function design
Input Expression: 2 + 2 * (1 * 2 - 4 / 2) * 1
Postfix (RPN): 2 2 1 2 * 4 2 / - * 1 * +
Evaluation Result: 0
g++ src/main.cpp -o evaluator
./evaluator
expression-evaluator/
โโโ README.md
โโโ src/
โโโ main.cpp