大神帮忙看看哪错了

P1449 后缀表达式

ttbr5145 @ 2018-07-29 01:18:43

var
num,ope:set of char;
sum:array[1..500] of integer;
i,tot,sumn:integer;
c:char;
begin
i:=1;
num:=['1'..'9'];
ope:=['+','-','*','/'];
repeat
read(c);
if c='.' then
begin
sum[i]:=sumn;
sumn:=0;
inc(i);
end;
if c in ope then
begin
if c='+' then sum[i-1]:=sum[i-1]+sum[i];
if c='-' then sum[i-1]:=sum[i-1]-sum[i];
if c='*' then sum[i-1]:=sum[i-1]*sum[i];
if c='/' then sum[i-1]:=sum[i-1] div sum[i];
sum[i]:=0;
end;
if c in num then sumn:=sumn*10+(ord(c)-ord('0'));
until c='@';
writeln(sum[1]);
end.

|