https://github.com/raghavendrajonnala2007/expression-evaluator
A C++ project that evaluates mathematical expressions using infix to postfix conversion and stack-based evaluatio
https://github.com/raghavendrajonnala2007/expression-evaluator
calculator compiler-basics cpp dsa infinix postfix stack
Last synced: about 1 year ago
JSON representation
A C++ project that evaluates mathematical expressions using infix to postfix conversion and stack-based evaluatio
- Host: GitHub
- URL: https://github.com/raghavendrajonnala2007/expression-evaluator
- Owner: Raghavendrajonnala2007
- Created: 2025-06-24T17:39:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-24T17:44:36.000Z (about 1 year ago)
- Last Synced: 2025-06-24T18:44:47.715Z (about 1 year ago)
- Topics: calculator, compiler-basics, cpp, dsa, infinix, postfix, stack
- Language: C++
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🧮 Expression Evaluator in C++
This is a C++ project that takes a mathematical infix expression (like `2 + 3 * (4 - 1)`) and:
1. Converts it to **postfix (Reverse Polish Notation)** format
2. Evaluates the postfix expression using a **stack**
It's basically how calculators or compilers handle expressions behind the scenes.
---
## 🚀 Features
- 🔄 Infix ➡️ Postfix conversion
- 🧠 Stack-based RPN evaluation
- ✍️ Handles brackets and operator precedence
- ⚙️ Uses STL (`stack`, `vector`, `string`)
- 💡 Modular code with clean function design
---
## 📸 Example
**Input Expression:**
2 + 2 * (1 * 2 - 4 / 2) * 1
**Postfix (RPN):**
2 2 1 2 * 4 2 / - * 1 * +
**Evaluation Result:**
0
---
## 🛠️ How to Run
### 🔧 Compile:
```bash
g++ src/main.cpp -o evaluator
./evaluator
expression-evaluator/
├── README.md
└── src/
└── main.cpp