function MaxElem(a: array[,] of integer; i: integer): integer;
var
j, m: integer;
begin
m := a[i, 0];
for j := 1 to length(a, 1) - 1 do
if a[i, j] > m then
m := a[i, j];
MaxElem := m
end;
procedure Input(var a: array[,] of integer);
i, j: integer;
Writeln('вводите элементы массива');
for i := 0 to length(a, 0) - 1 do
for j := 0 to length(a, 1) - 1 do
read(a[i, j]);
procedure Output(var a: array of integer);
i: integer;
Writeln('полученный массив');
for i := 0 to length(a) - 1 do
write(a[i], ' ');
m, n, i: integer;
a: array[,] of integer;
b: array of integer;
read(m, n); // ввод числа строк и столбцов
setlength(a, m, n);
setlength(b, m);
Input(a);
for i := 0 to m - 1 do
b[i] := MaxElem(a, i);
Output(b);
end.
Написано на Free Pascal
function MaxElem(a: array[,] of integer; i: integer): integer;
var
j, m: integer;
begin
m := a[i, 0];
for j := 1 to length(a, 1) - 1 do
if a[i, j] > m then
m := a[i, j];
MaxElem := m
end;
procedure Input(var a: array[,] of integer);
var
i, j: integer;
begin
Writeln('вводите элементы массива');
for i := 0 to length(a, 0) - 1 do
for j := 0 to length(a, 1) - 1 do
read(a[i, j]);
end;
procedure Output(var a: array of integer);
var
i: integer;
begin
Writeln('полученный массив');
for i := 0 to length(a) - 1 do
write(a[i], ' ');
end;
var
m, n, i: integer;
a: array[,] of integer;
b: array of integer;
begin
read(m, n); // ввод числа строк и столбцов
setlength(a, m, n);
setlength(b, m);
Input(a);
for i := 0 to m - 1 do
b[i] := MaxElem(a, i);
Output(b);
end.
Написано на Free Pascal
var
s: string;
i, count: integer;
begin
writeln('Vvedite stroky: ');
readln(s);
for i := 1 to length(s) - 2 do
if copy(s, i, 3) = 'abc' then
count := count + 1;
writeln('Kol-vo: ', count);
end.
2.
var
s1, s2: string;
i, len1, len2: integer;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
len1 := length(s1);
len2 := length(s2);
if len1 > len2 then writeln('1 stroka dlinnee')
else if len1 < len2 then writeln('2 stroka dlinnee')
else writeln('dlini strok ravnie')
end.
3.
var
s1, s2, s3: string;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
s3 := s1[1] + s1[2] + s2[1] + s2[2];
writeln('Novaja stroka: ', s3);
end.