Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 502 Bytes

README.md

File metadata and controls

9 lines (5 loc) · 502 Bytes

Command-line Calculator

This is a commandline calculator that takes in an expression, stores the numbers/operators in an abstract syntax tree, and returns the result.

This can account for parentheses, modulus, adddition, subtraction, modulus, division (negative and positive numbers). This cannot yet take care of decimals, however.

To compile the program, do gcc evalexpr.c and use ./a.out "EXPRESSION" to see the answer.

E.g. ./a.out "3 + 5" or ./a.out "(3 * 5) + 6".