Show the definition of sum by drawing a contour diagram for the code below. Show one contour
Fantastic news! We've Found the answer you've been seeking!
Question:
Show the definition of sum by drawing a contour diagram for the code below. Show one contour diagram indicated by the * and another diagram for the **. For each * and ** draw a static and a dynamic scoped contour diagram.
begin
integer sumf;
real procedure f(x);
value x; real x;
f := x * x;
real proecedure sum;
begin real S, x; s:= 0; s:=0;
for x := x + 0.01 while x <= 1 do
S := S + f(x);
sum := S / 100;
end;
begin
real procedure f(x);
value x; real x;
f := x^2 + 1;
sumf := sum; *
end;
begin
real procedure f(x);
value x; real x;
f := cos(x) + sin(x);
sumf := sum; **
end;
end;
Related Book For
Posted Date: