Exercise: calculator STDIN
Write a command-line calculator that works with the 4 basic operators +-*/
like this:
$ go run cacl.go
a: 3
op: +
b: 4
7
$ go run calc.go
a: 8
op: /
b: 2
4
- What happens if we try to divide by 0?
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
Write a command-line calculator that works with the 4 basic operators +-*/
like this:
$ go run cacl.go
a: 3
op: +
b: 4
7
$ go run calc.go
a: 8
op: /
b: 2
4