перевести код из паскаль в делфи const nMax = 50;
cGold = 7;
cSilver = 6;
cBronze = 5;
type
cName = string[20];
RC = record
position: byte;
name: cName;
nGold: byte;
nSilver: byte;
nBronze: byte;
cTotal: byte
end;
tM = array[1..nMax, 1..2] of byte;
procedure Shell(var a: tM; n: integer);
var i, j, step, t1, t2: integer;
begin
step := n div 2;
while step > 0 do
begin
for j := n - step downto 1 do
begin
i := j;
while i <= n - step do
begin
if a[i, 2] < a[i + step, 2] then
begin
t1 := a[i, 1]; t2 := a[i, 2];
a[i, 1] := a[i + 1, 1]; a[i, 2] := a[i + 1, 2];
a[i + 1, 1] := t1; a[i + 1, 2] := t2
end;
i := i + step
end
end;
step := step div 2
end
end;
var
f: file of RC;
a: tM;
i, n: byte;
s: cName;
t: RC;
begin
Assign(f, 'Olympic.in');
Rewrite(f);
n := 0;
repeat
Writeln('Vvedite naimenovanie komandy ili * dlya okonchaniya vvoda');
Readln(s);
if s[1] <> '*' then
begin
n := n + 1;
Write('Kolichestvo medaley: zoloto, serebro, bronza: ');
Readln(t.nGold, t.nSilver, t.nBronze);
t.position := n;
t.name := s;
t.cTotal := t.nGold * cGold + t.nSilver * cSilver + t.nBronze * cBronze;
Write(f, t);
a[n, 1] := t.position; a[n, 2] := t.cTotal
end
until s[1] = '*';
Reset(f);
Shell(a, n);
Writeln('Rezultaty olympiady');
for i := 1 to n do
begin
seek(f, a[i, 1] - 1);
Read(f, t);
Writeln(i, ': ', t.name, ' ', t.nGold, ' ', t.nSilver, ' ',
t.nBronze, ' ', t.cTotal)
end;
readln;
Close(f);
end.
Блин, ето что то вообще сложно