uses
Crt;
const
n = 8;
m = 10;
var
A: array[1..m, 1..n] of real;
L, R, i, j, S: integer;
x, k: real;
Sort: boolean;
begin
clrscr;
randomize;
for i := 1 to m do
for j := 1 to n do
A[i, j] := random(100) / 10;
writeln('Матрица A');
repeat
Sort := False;
for i := 1 to m do
for j := 1 to n - 1 do
if A[i, j] > A[i, j + 1] then begin
k := A[i, j];
A[i, j] := A[i, j + 1];
A[i, j + 1] := k;
Sort := True;
end;
until
sort = False;
for i := 1 to m do
begin
for j := 1 to n do
write(A[i, j]:6:1);
writeln;
end;
writeln;
writeln('Ввод x');
readln(x);
for i := 1 to m do
begin
L := 1;
R := n;
while L < R do
begin
j := trunc((L + R) / 2);
if A[i, j] < x then
L := j + 1
else
R := j;
end;
if A[i, R] = x then
writeln('В ', i, ' строке позиция x:', i, ',', R)
else
writeln('В ', i, ' элемент не найден');
end;
readkey;
end.