https://github.com/carlosrs14/expression-evaluator
A program that evaluates arithmetic expressions using postfix notation.
https://github.com/carlosrs14/expression-evaluator
cpp evaluate-math-expressions maths postfix-evaluation postfix-notation university-assignment
Last synced: 1 day ago
JSON representation
A program that evaluates arithmetic expressions using postfix notation.
- Host: GitHub
- URL: https://github.com/carlosrs14/expression-evaluator
- Owner: carlosrs14
- Created: 2024-04-08T01:02:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-21T03:27:44.000Z (5 days ago)
- Last Synced: 2025-12-22T23:28:48.708Z (3 days ago)
- Topics: cpp, evaluate-math-expressions, maths, postfix-evaluation, postfix-notation, university-assignment
- Language: C++
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Arithmetic Expression Evaluator
This is a C++ project that evaluates infix arithmetic expressions by converting them to postfix notation (Reverse Polish Notation) for calculation.
## Features
- Converts infix expressions to postfix.
- Evaluates the resulting postfix expression.
- Supports operators: `+`, `-`, `*`, `/`, `^`.
- Handles multi-digit and decimal numbers.
- Includes parenthesis handling.
- Error validation for invalid expressions (e.g., unbalanced parentheses, division by zero).
## How to Compile and Run
You can compile the project using g++. Make sure you have a C++ compiler compatible with C++11 or higher.
```bash
g++ -I include example.cpp src/evaluator.cpp src/posfix-evaluator.cpp -o example
```
if linux user could use:
```
compile.sh
```
Once compiled, you can run the example program:
```bash
./example
```
## Example Usage
- Example 1:

- Example 2:

## TODO
1. Add trigonometrics expressions handlers
2. Add params support
3. Add evaluation by prefix notation