TList的一个问题(50分)

  • 主题发起人 主题发起人 sunjialong
  • 开始时间 开始时间
S

sunjialong

Unregistered / Unconfirmed
GUEST, unregistred user!
下面代码中加!!!! 的语句为什么错?
type
PERadical=^ERadical;
Fraction=Record
n:Int64;
d:Int64;
end;
ERadical=Record
q:Fraction;
r:Int64;
end;
Radical=Record
r:Fraction;
i:Tlist;
end;

function StrToRad(i:String):Radical;
var
a:String;
dd,bb,bbb,b4:Integer;
t:PInteger;
out:Radical;
kk:byte;
b,c,cc:TList;
begin
a:=i;
b:=TList.Create ;
for bb:=1 to Length(a)do
begin
if (MidStr(a,bb,1)='+') or (MidStr(a,bb,1)='-') then
begin
New(t);
t^:=bb;
b.Add(t);
end;
end;
if b.Count =0 then
begin
New(t);
t^:=0;
b.Add(t);
end;
for bbb:=1 to Length(a)do
begin
if LeftStr(a,1)='s' then
begin
New(t);
t^:=1;
b.Add(t);
a:='+1'+a;
for bb:=1 to b.Count -1do
begin
!!!!!!!!!! b[bb]^:=b[bb]^+1;
b[bb]:=t;
end;
exit;
end;
end;
end;
 
什么错误?
 
错误:Operator not applicable to this operand type
 
因为b[bb]只是个通用的指针,并不是整数指针。你改成Integer(b[bb]^)试试。
 
接受答案了.
 
后退
顶部