2010-09-14, 09:37 PM
Fiel Wrote:Read one line at a time. Do one thing at a time.
Recurse everything! No limits!
Also, implement subtraction as A + -B (instead of plus(a,b), it'll be add(a,b,negative)). It'll be awesome.
1234
- 207
4 + -7 = 7 (carry -1)
-1 + 3 + -0 = 2 (carry 0)
2 + -2 = 0 (carry 0)
1 + -0 = 1
1027!
I wish they'd taught subtraction this way in school.
1000
- 1
0 + -1 = 9 (carry -1)
-1 + 0 = 9 (carry -1)
-1 + 0 = 9 (carry -1)
-1 + 1 = 0
999!

