|
|
вернуться в форумCrash (access violation) №9 Program N1226; var T:Array[1..10000] of char;
S:string; i,j,Len:integer; BEGIN i:=0; while (not eof) do begin inc(i); read(T[i]); end; Len:=i; T[i+1]:='!'; i:=1; S:=''; while (i<=Len+1) do if (T[i] in ['a'..'z','A'..'Z']) then begin S:=S+T[i]; inc(i) end else begin for j:=length(s) downto 1 do write(s[j]); S:=''; if i<=Len then write(T[i]); inc(i); end; END. Crash (access violation) №9 !!!!!!!!!!!!!!!!!!! BUT When I add: "W:array [1..255] of char;" Program N1226; var T:Array[1..10000] of char; W:array [1..255] of char; //<----------Accepted S:string; i,j,Len:integer; BEGIN i:=0; while (not eof) do begin inc(i); read(T[i]); end; Len:=i; T[i+1]:='!'; i:=1; S:=''; while (i<=Len+1) do if (T[i] in ['a'..'z','A'..'Z']) then begin S:=S+T[i]; inc(i) end else begin for j:=length(s) downto 1 do write(s[j]); S:=''; if i<=Len then write(T[i]); inc(i); end; END. Accepted! Why??? Edited by author 28.11.2009 18:51 Re: Crash (access violation) №9 Yep.. it is strange. Array W is not used at second program and codes are the same |
|
|