|
|
back to boardHelp me!Help me!Help me!Help me!Help me!Help me!........... Posted by gc007 1 Nov 2002 14:56 Why do I get Crash (ACCESS_VIOLATION)??? This is my program. var on,tw,th,good:array[1..510]of longint; s:array[1..510]of string; n:longint; procedure zl; var i:integer; f:set of char; c:char;t:text; begin f:=[]; for c:='a' to 'z' do f:=f+[c]; for c:='A' to 'Z' do f:=f+[c]; assign(t,'');reset(T); readln(t,n); for i:=1 to n do begin read(t,c);s[i]:=''; repeat s[i]:=s[i]+c; read(t,c); until not (c in f); readln(t,on[i],tw[i],th[i]); end; close(T); end; procedure gc; var i,j,max,ho:longint; begin fillchar(good,sizeof(good),0);max:=0; for i:=1 to n-1 do begin for j:=i+1 to n do if ((on[i]>on[j])and(tw[i]>tw[j])) or ((th[i]>th[j])and(tw[i]>tw[j])) or ((on[i]>on[j])and(th[i]>th[j])) then inc(good[i]) else inc (good[j]); if good[i]>max then begin max:=good[i]; ho:=i; end; end; for i:=1 to n do if ((on[i]>on[ho])and(tw[i]>tw[ho])) or ((th[i]>th[ho])and(tw[i]>tw[ho])) or ((on[i]>on[ho])and(th[i]>th[ho])) or (good[i]=good[ho])then writeln(s[i]); end; begin zl; gc; end. Re: Help me!Help me!Help me!Help me!Help me!Help me!........... Posted by Azrael 4 Nov 2002 00:38 This part of program get Crash (ACCESS_VIOLATION) f:=[]; for c:='a' to 'z' do f:=f+[c]; for c:='A' to 'Z' do f:=f+[c]; I don't know why :)) But it is. |
|
|