Advertisement
huyhung94

Giải thuật định giá biểu thức hậu tố

Oct 5th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.38 KB | None | 0 0
  1. program Dinh_gia;
  2. BEGIN
  3.     Repeat
  4.         Đọc phần tử X tiếp theo của biểu thức;
  5.         if (X là toán hạng) then
  6.             PUSH(S,T,X)
  7.         else
  8.             begin
  9.                 Y:=POP(S,T);
  10.                 Z:=POP(S,T);
  11.                 Thực hiện phép toán X với các toán hạng Y và Z
  12.                 gán kết quả cho W;
  13.                 PUSH(S,T,W);
  14.             End;
  15.     until (Đọc hết xâu biểu thức);
  16.     R:=POP(S,T);
  17.     write(R);
  18. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement