Обчислення иразів у програмуванні, Детальна інформація
Обчислення иразів у програмуванні
ops : begin
pop( Slx, lx2 ); pop( Slx, lx1 );
case lx.sig of
'+' : lx1.numb := lx1.numb + lx2.numb;
'-' : lx1.numb := lx1.numb - lx2.numb;
'*' : lx1.numb := lx1.numb * lx2.numb;
'/' : if lx2.numb <> 0 then
lx1.numb := lx1.numb / lx2.numb
else ok := false
end;
if ok then push( Slx, lx1 )
end;
nam : begin
pop( Slx, lx1 );
if lx.name = 'sin' then
lx1.numb := sin( lx1.numb ) else
if lx.name = 'cos' then
lx1.numb := cos( lx1.numb );
push( Slx, lx1 )
end
end { case lx.stl }
end; { while }
if ok then
begin pop( Slx, lx1); llxval := lx1.numb end
else
begin
writeln( '***zerodivide***' ); llxval := 0
end
end;
8. Множини в мові Паскаль
pop( Slx, lx2 ); pop( Slx, lx1 );
case lx.sig of
'+' : lx1.numb := lx1.numb + lx2.numb;
'-' : lx1.numb := lx1.numb - lx2.numb;
'*' : lx1.numb := lx1.numb * lx2.numb;
'/' : if lx2.numb <> 0 then
lx1.numb := lx1.numb / lx2.numb
else ok := false
end;
if ok then push( Slx, lx1 )
end;
nam : begin
pop( Slx, lx1 );
if lx.name = 'sin' then
lx1.numb := sin( lx1.numb ) else
if lx.name = 'cos' then
lx1.numb := cos( lx1.numb );
push( Slx, lx1 )
end
end { case lx.stl }
end; { while }
if ok then
begin pop( Slx, lx1); llxval := lx1.numb end
else
begin
writeln( '***zerodivide***' ); llxval := 0
end
end;
8. Множини в мові Паскаль
The online video editor trusted by teams to make professional video in
minutes
© Referats, Inc · All rights reserved 2021