L
lizhihong158
Unregistered / Unconfirmed
GUEST, unregistred user!
我想实现cc串中的计算,但用下列代码无法将P1,P2,P3中的值传递过去,
请问各位下面代码该如何改?或该如何才能实现cc中的计算?我太菜,
请讲详细一点,谢谢!
var
script: OLEVariant;
P1,P2,P3: Integer;
bb,cc:string;
begin
bb:= '12345';
P1:= StrToInt(copy(bb,1,1));
P2:= StrToInt(copy(bb,2,1));
P3:= StrToInt(copy(bb,3,1));
cc:= '(n1 + n2 + n3) mod 4';
script := CreateOleObject('ScriptControl');
script.Language := 'VBScript';
script.AddCode('Dim n1,n2,n3');
script.AddCode('n1=P1');
script.AddCode('n2=P2');
script.AddCode('n3=P3');
Memo1.Text:= script.Eval(cc);
end;
请问各位下面代码该如何改?或该如何才能实现cc中的计算?我太菜,
请讲详细一点,谢谢!
var
script: OLEVariant;
P1,P2,P3: Integer;
bb,cc:string;
begin
bb:= '12345';
P1:= StrToInt(copy(bb,1,1));
P2:= StrToInt(copy(bb,2,1));
P3:= StrToInt(copy(bb,3,1));
cc:= '(n1 + n2 + n3) mod 4';
script := CreateOleObject('ScriptControl');
script.Language := 'VBScript';
script.AddCode('Dim n1,n2,n3');
script.AddCode('n1=P1');
script.AddCode('n2=P2');
script.AddCode('n3=P3');
Memo1.Text:= script.Eval(cc);
end;