Simple command line calculator.
gcc src/calc.c -lm -o calc
gcc src/calc.c -o calc.exe
calc <equation>
Currently Supports: powers, division, multiplication, addition and subtraction (see issues for roadmap)
N.B. Use x
rather than *
for multiplication, or surround the whole argument in speech marks: "<equation>"
Windows Notes:
- Use
'
rather than^
for powers, or surround the whole argument in speech marks:"<equation>"
- Substitue
./calc
forcalc.exe
below
Most simple usage of calc(n)
:
$ ./calc 1 + 1
= 2
Precedence is correctly respected:
$ ./calc 2 + 4 x 50 + 2
= 204
Powers also work
$ ./calc 2^3
= 9
A few constants (e, pi and phi) are built in:
$ ./calc 2 * pi
= 6.28318530717959