home *** CD-ROM | disk | FTP | other *** search
- Program CrossCountry; {By Kevin Hellman}
-
- type
- string7=string[7];
- string10=string[10];
- Data= record {this record holds all the good data}
- Name :string7;
- School:string10;
- time :string7;
- num:integer;
- end; {data}
-
- Var
- datalist : array[1..100] of data; {this holds the records}
- maxentries: integer; {line till EOF}
- SchoolList:array[1..20] of string10; {list of schools}
- maxschools: integer; {number of schools}
-
- procedure GetInfo; {reads that good 'ol data file}
- var
- n:text;
- begin
- Maxentries:=0;
- Assign(N,'Runner.dat');
- Reset(N);
- while not(eof(N)) do
- begin
- maxentries:=maxentries+1;
- with datalist[maxentries] do
- begin
- read(N,Name);
- read(N,School);
- read(N,Time);
- readln(N,Num);
- end;
- end;
- end; {getinfo}
-
- Procedure Sortnames; {Sort those names}
- var
- counter :integer;
- Templow :string;
- Previous :string;
- Secounter:integer;
- begin
- Writeln;
- Writeln('Official Alphabetized List of Names'); {Yes ! the infamous}
- Writeln('-------- ------------ ---- -- -----'); {Super-Kev Sort}
- templow:='ZZZ';
- for counter:=1 to maxentries do
- if datalist[counter].Name<templow then templow:=datalist[counter].Name;
- Writeln(Templow);
- Previous:=templow;
- For Secounter:=1 to maxentries do
- begin
- Templow:='ZZZ';
- For counter:=1 to maxentries do
- if (datalist[counter].Name<templow) and (datalist[counter].Name>previous)
- then templow:=datalist[counter].Name;
- if Templow<>'ZZZ' then writeln(templow);
- Previous:=templow;
- end;
- end; {Sortnames}
-
-
- Procedure SortSchools; {gee, now what could this do ?}
- var
- counter :integer; {NO, it is not a flight simulator}
- Templow :string;
- Previous :string;
- Secounter:integer;
- begin
- Writeln;
- Writeln('Official Alphabetized List of Schools');
- Writeln('-------- ------------ ---- -- -------');
- templow:='ZZZ';
- for counter:=1 to maxentries do
- if datalist[counter].School<templow then templow:=datalist[counter].School;
- Writeln(Templow);
- Maxschools:=1;
- Schoollist[Maxschools]:=templow;
- Previous:=templow;
- For Secounter:=1 to maxentries do
- begin
- Templow:='ZZZ';
- For counter:=1 to maxentries do
- if (datalist[counter].School<templow) and (datalist[counter].School>previous)
- then templow:=datalist[counter].School;
- if Templow<>'ZZZ' then
- begin
- Maxschools:=Maxschools+1;
- Schoollist[Maxschools]:=templow;
- writeln(templow);
- end;
- Previous:=templow;
- end;
- end; {sortschools}
-
- Procedure ListforEachSchool; {prepares a list for each school}
- var
- counter:integer;
- c: integer;
- begin
- for counter:=2 to maxschools do
- begin
- Writeln;
- Writeln('Official list of Participants for ',Schoollist[counter]);
- writeln('--------------------------------------------------------');
- writeln;
- For c:=1 to maxentries do
- if datalist[c].school=schoollist[counter] then
- Writeln(Datalist[c].name);
- end;
- end; {list for each school}
-
- Function Timevalue(Calcit:string):integer; {My secret ingredient}
- Var {Handles strings of times}
- p1,p2,temp:integer; {IT works rather well}
- begin
- val(calcit[1],p1,temp);
- val(calcit[3]+calcit[4],p2,temp);
- timevalue:=p1*60+p2;
- end; {timevalue}
-
- Procedure Timelist; {Yes, Now it list the winners}
- var
- counter :integer;
- Templow :integer;
- Previous :integer; {and losers....CSII ?}
- Secounter:integer;
- Lowindex :integer;
- begin
- writeln;
- Writeln('Official List of Names of Sorted Time');
- Writeln('-------- ---- -- ----- -- ------ ----');
- writeln;
- templow:=1000;
- for counter:=1 to maxentries do
- if TimeValue(datalist[counter].time)<templow then
- begin
- templow:=TimeValue(datalist[counter].time);
- Lowindex:=counter;
- end;
- Writeln(Datalist[lowindex].name);
- Previous:=templow;
- For Secounter:=1 to maxentries do
- begin
- Templow:=1000;
- For counter:=1 to maxentries do
- if (timevalue(datalist[counter].Time)<templow) and (Timevalue(datalist[counter].Time)>previous)
- then
- begin
- templow:=TimeValue(datalist[counter].time);
- Lowindex:=counter;
- end;
- if Templow<>1000 then writeln(Datalist[Lowindex].Name);
- Previous:=templow;
- end;
- end; {timelist}
-
- begin {MAINLINE}
- Getinfo;
- Sortnames;
- SortSchools;
- Listforeachschool;
- Timelist;
- end. {Mainline}
-