C
Chad
I'm supposed to write a program that calculates arithmetic expressions
using prefix notation. The one example our professor gave us is
(+ (- 6) (* 2 3 4) (/ (+ 3) (* 1) (- 2 3 1)))
Which evaluated sucessively becomes..
(+ (- 6) (* 2 3 4) (/ 3 1 -2)) //<----I don't see how he arrives at
this expression
(+ -6 24 -1.5)
16.5
I don't see how he gets (+ (- 6) (* 2 3 4) (/ 3 1 -2)) from (+ (- 6)
(* 2 3 4) (/ (+ 3) (* 1) (- 2 3 1)))
Chad
using prefix notation. The one example our professor gave us is
(+ (- 6) (* 2 3 4) (/ (+ 3) (* 1) (- 2 3 1)))
Which evaluated sucessively becomes..
(+ (- 6) (* 2 3 4) (/ 3 1 -2)) //<----I don't see how he arrives at
this expression
(+ -6 24 -1.5)
16.5
I don't see how he gets (+ (- 6) (* 2 3 4) (/ 3 1 -2)) from (+ (- 6)
(* 2 3 4) (/ (+ 3) (* 1) (- 2 3 1)))
Chad