求教

P1307 [NOIP2011 普及组] 数字反转

huanglth @ 2017-10-29 15:23:11

请问dalao,k:=k+s[i]和k:=s[i]+k 有什么区别?(k,s:string)


by huanglth @ 2017-10-29 15:27:22

var
 n,i:longint;
 s,k:string;
begin
readln(n);
if n>0 then str(n,s) else str(-n,s);
for i:=1 to length(s) do
 begin
--------  k:=s[i]+k;---------
 end;
while (k[1]='0') and (length(k)>=2) do
 delete(k,1,1);
if n>0 then writeln(k) else writeln('-',k);
end.

|