Hello this was a nice introduction to parsing and tokenizing equations. Calculations can be parsed from our normal notation to reverse Polish notation using Dijkstra's shunting algorithm. The equation can then be solved recursively, with a support for a variety of different operations.
git clone https://github.com/mrkingseasheep/basic-calculator.git
Then compile main.cpp
make
OR
g++ main.cpp -o calculator.app
Then run the binary: ./calculator.app
Ensure you have rofi
installed.
Compile the binary.
Edit calc.sh
and follow the instructions there.
Run calc.sh
Profit.
Remember to properly use (brackets) 👍
- +-/*
- ^%!
- sin cos tan
- min max
- lcm and gcd
For min, max, lcm and gcd, follow the following notation:
lcm(2, 4)
%, !, lcm and gcd will truncate (NOT ROUND) any floating point number.
- arctan and the other funny trigonometry operations (just a change to the regex)
- currency conversion
- support for constants
- unit conversion