Welcome to my awesome calculator project! This C++ program can take a mathematical expression as a string and calculate the result. It supports the basic arithmetic operations (
, +
, -
, *
, /
, )
The project is being compiled using Makefile
with means that you need a Unix system to run it (MacOS, Linux, WSL).
And supports the order of operations.
This project represents the knowledge I've acquired so far in my journey of learning C++.
- Perform arithmetic operations
(
,+
,-
,*
,/
,)
- Handle complex expressions with parentheses.
- Easy-to-use interface that support the regular way of writing mathematical expressions.
- Written in C++ for efficiency and performance.
- The project uses only the standard library so if you have a Compiler, you already set.
To use this calculator in your project, follow these simple steps:
-
Clone this repository to your local machine:
git clone https://github.com/YanivZalach/Math_Calculator.git ~/Documents/calculate
-
Compile the C++ source code using
Makefile
:make all
-
Run the program:
./calculator
-
Add to
.bashrc
:alias calc="$HOME/Documents/calculate/calculator"
Now you can run the calculator from everywhere using:
calc
You can use the calculator by providing a mathematical expression. For example:
$ calc
Math exasperation: (5 + 3) * 2 / (7 - 2)
>> 3.2
Here are some examples to try:
2 + 3
(5 - 2) * 4 / 2
10 / (2 + 3)
You can't write decimal numbers by using the .
operator, instead use the /
operator.
0.8 = (8/10)
This project is licensed under the MIT License.