|
|
back to boardWhy this program get Compilation error? var st:array [1..100] of string; qwe:string; i,w,n,j,k,l:longint; Procedure prover(q:longint); var e:longint; begin w:=0; for e:=q to length(st[i]) do begin if (st[i][e] in ['a'..'z']) or (st[i][e] in ['A'..'Z']) then begin inc(w); qwe:=qwe+st[i][e]; end else exit; end; end; begin while not eof do begin inc(n); readln(st[n]); end; for i:=1 to n do begin for j:=1 to length(st[i]) do begin if st[i][j]=' ' then write(' ') else begin if (st[i][j] in ['a'..'z']) or (st[i][j] in ['A'..'Z']) then begin qwe:=''; prover(j); for l:=w downto 1 do write(qwe[l]); j:=j+w-1; end else write(st[i][j]); end; end; writeln; end; end. Re: Why this program get Compilation error? var st:array [1..100] of string; qwe:string; i,w,n,j,k,l:longint; Procedure prover(q:longint); var e:longint; begin w:=0; for e:=q to length(st[i]) do begin if (st[i][e] in ['a'..'z']) or (st[i][e] in ['A'..'Z']) then begin inc(w); qwe:=qwe+st[i][e]; end else exit; end; end; begin while not eof do begin inc(n); readln(st[n]); end; for i:=1 to n do begin for j:=1 to length(st[i]) do begin if st[i][j]=' ' then write(' ') else begin if (st[i][j] in ['a'..'z']) or (st[i][j] in ['A'..'Z']) then begin qwe:=''; prover(j); for l:=w downto 1 do write(qwe[l]); j:=j+w-1; // You can't change j in loop!!! end else write(st[i][j]); end; end; writeln; end; end. j:=j+w-1; // You can't change j in loop!!! Edited by author 28.02.2007 22:03 |
|
|