Compare commits
No commits in common. "88b4ddf6820d219cbc97c9d5ce9492b109099222" and "f937af9cbe63a91524fbfc6923028987690707a3" have entirely different histories.
88b4ddf682
...
f937af9cbe
38
README.md
38
README.md
|
|
@ -1,39 +1,3 @@
|
||||||
# tc-calc
|
# tc-calc
|
||||||
|
|
||||||
Our built-in calculator. This is the REPL loop used by Terminal Click.
|
Our built-in calculator. This is the REPL loop used by Terminal Click.
|
||||||
|
|
||||||
## Build Instructions
|
|
||||||
|
|
||||||
`cc main.c -o calc -lm`
|
|
||||||
|
|
||||||
Where `cc` is our C compiler e.g. `gcc`, `clang`, `zig cc`.
|
|
||||||
|
|
||||||
## How to Use
|
|
||||||
|
|
||||||
Run the executable `calc` to be greeted with the following prompt:
|
|
||||||
|
|
||||||
`calc>`
|
|
||||||
|
|
||||||
Now we type any valid arithmetic expression as we would in a Python REPL:
|
|
||||||
|
|
||||||
```
|
|
||||||
calc> (2+2)*(2+2)
|
|
||||||
16
|
|
||||||
calc>
|
|
||||||
```
|
|
||||||
|
|
||||||
Notice how we print the output with a bit of spacing followed by a new prompt.
|
|
||||||
|
|
||||||
**Switching Formats**
|
|
||||||
|
|
||||||
We can switch between decimal, hexadecimal and binary formats. Use the `:dec`, `:hex`, or `:bin` tags:
|
|
||||||
|
|
||||||
```
|
|
||||||
calc> :hex
|
|
||||||
format: hex
|
|
||||||
calc> 0xA - 0x9
|
|
||||||
0x1
|
|
||||||
calc>
|
|
||||||
```
|
|
||||||
|
|
||||||
The default tag is `:dec`.
|
|
||||||
Loading…
Reference in New Issue