This repository contains a simple C++ program that evaluates mathematical expressions using variables and standard operators. It supports basic arithmetic operations, parentheses, and exponentiation.
- Define variables and use them in expressions.
- Support for common operators:
+
,-
,*
,/
,^
. - Converts infix expressions to postfix notation for evaluation.
- Clone the repository:
git clone https://github.com/your-repo-link.git cd your-repo-directory
- Compile the program:
bash Copy code g++ -o calculator calculator.cpp -std=c++11
- Run the program:
bash Copy code ./calculator
- Example Input: Variables:
var1 = 5
var2 = 3
Expression:
var1 + var2 * (2 ^ 3) Output: Postfix Expression: var1 var2 2 3 ^ * +
Result: 29