Const n=3; type lec=record name:string; cost:integer; end; var a:array [1..n] of lec; max1:integer; m,k,p,i:byte; begin for i:=1 to n do with a[i] do begin writeln ('Введи наименование товара'); readln (name); writeln ('введи стоимость товара'); readln (cost); end; max1:=-1; for i:=1 to n do if a[i].cost>max1 then begin max1:=a[i].cost; p:=i; end; while k<>1 do begin for i:=1 to n do if (i<>p) and (a[i].cost=max1) then begin m:=i; k:=1; end; max1:=max1-1; end; writeln (a[p].name,' ',a[p].cost); write (a[m].name,' ',a[m].cost); readln; end.
type lec=record
name:string;
cost:integer;
end;
var a:array [1..n] of lec;
max1:integer;
m,k,p,i:byte;
begin
for i:=1 to n do
with a[i] do begin
writeln ('Введи наименование товара');
readln (name);
writeln ('введи стоимость товара');
readln (cost);
end;
max1:=-1;
for i:=1 to n do
if a[i].cost>max1 then begin max1:=a[i].cost;
p:=i;
end;
while k<>1 do begin
for i:=1 to n do
if (i<>p) and (a[i].cost=max1) then begin m:=i;
k:=1;
end;
max1:=max1-1;
end;
writeln (a[p].name,' ',a[p].cost);
write (a[m].name,' ',a[m].cost);
readln;
end.