DELphi中声明过程 数字字符串转换为数值型数据 循环里语句Incompatible types: 'Integer' and 'Extended'
procedurechange(a:string);varsum,i,j:integer;beginj:=length(a);fori:=1tojdosum:=sum+e...
procedure change(a:string);
var
sum,i,j:integer;
begin
j:= length(a);
for i:=1 to j do
sum:=sum+exp((j-i)*ln(10))*(Ord(a[i])-48);
showmessage(inttostr(sum));
procedure TForm1.Button1Click(Sender: TObject);
begin
change(edit1.text);
end;
end; 展开
var
sum,i,j:integer;
begin
j:= length(a);
for i:=1 to j do
sum:=sum+exp((j-i)*ln(10))*(Ord(a[i])-48);
showmessage(inttostr(sum));
procedure TForm1.Button1Click(Sender: TObject);
begin
change(edit1.text);
end;
end; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询