Dze je subor www.TrSek.com/beginner/danciwo/preteky.pas{ PRETEKY.PAS Copyright (c) Danciwo }
{ Na vstupe je postupnost N dvojic: meno pretekara a dosiahnuty cas }
{ zadanych z klavesnice. Zostavte program, ktory vypise tabulku N }
{ zadanych dvojic, zisti a vypise meno pretekara s najkratsim }
{ a najdlhsim casom. }
{ }
{ Author: Danciwo }
{ Date : 15.02.2008 http://www.trsek.com }
program preteky;
uses crt;
type osoba= record
meno: string;
cas: integer;
end;
var student: array[1..3] of osoba;
i,min,a,b,j,max:integer;
begin
clrscr;
for i:=1 to 3 do begin
write('Zadajte meno pretekara cislo ', i,':');
readln(student[i].meno);
write('Zadajte cas pretekara cislo ',i,':');
readln(student[i].cas);
end;
writeln(' meno ',' cas ');
for i:=1 to 3 do begin
writeln(student[i].meno:5,student[i].cas:9);
end;
min:=10000;
max:=0;
for i:=1 to 3 do begin
if min > student[i].cas then begin
min:= student[i].cas;
a:=i;
end;
end;
for j:=1 to 3 do begin
if max< student[j].cas then begin
max:= student[j].cas;
b:=j;
end;
end;
writeln('vyhral pretekar: ',student[a].meno);
writeln('posledny bol pretekar: ',student[b].meno);
readln;
end.