|
|
вернуться в форумWhy my program get 'Compilation error'?Could someone help me? My program works well on my own computer with Free Pascal IDE 2.2.0. But when I submitted it, it got 'Compilation error'. I'm really confused. Could someone help me? Thanks. Re: Why my program get 'Compilation error'?Could someone help me? Послано rGV 27 ноя 2007 22:42 check is "uses" in your program Re: Why my program get 'Compilation error'?Could someone help me? I didn't use any 'uses'... Here is my program: var s,f: array [0..500] of string; i,j,k,n,t: longint; tmp: string; function compare(var a,b: string): boolean; var i: longint; begin i:=0; while (i<length(a)) and (i<length(b)) do begin inc(i); if (a[i]='\') and (b[i]<>'\') then begin compare:=false; exit; end; if (a[i]<>'\') and (b[i]='\') then begin compare:=true; exit; end; if a[i]<b[i] then begin compare:=false; exit; end else if a[i]>b[i] then begin compare:=true; exit; end; end; if i=length(a) then compare:=false else compare:=true; end; function check(var s: string): longint; begin check:=1; while (f[check]<>'') and ((f[check]+'\')=copy(s,1,length(f[check])+1)) do begin delete(s,1,length(f[check])+1); inc(check); end; end; begin readln(n); for i:=1 to n do readln(s[i]); for i:=1 to n-1 do for j:=i+1 to n do if compare(s[i],s[j]) then begin tmp:=s[i]; s[i]:=s[j]; s[j]:=tmp; end; for i:=1 to n do begin k:=check(s[i]); while s[i]<>'' do begin t:=pos('\',s[i]); if t=0 then begin s[i]:=s[i]+'\'; t:=length(s[i]); end; f[k]:=copy(s[i],1,t-1); for j:=1 to k-1 do write(' '); writeln(f[k]); inc(k); delete(s[i],1,t); end; end; end. |
|
|