Procedure sovp; var i, j, r, c: byte; ar: array[1..10, 1..10]of byte; s: array[1..4] of string; b: boolean; label l1; begin r := random(2, 3); l1: c := 1; b := false; for i := 1 to 10 do for j := 1 to 10 do begin ar[i, j] := random(0, 1); if(i < 5) then s[i] := ''; end; for i := 1 to 9 do begin for j := 1 to 10 do begin if(ar[i, j] <> ar[i + 1, j]) then b := true; end; if(b = false) then begin s[c] := i + ' строка совпалает с ' + (i + 1) + ' строкой'; c := c + 1; end; b := false; end; if(c <> r) then goto l1 else begin for var k := 1 to c do if(k<>c)then writeln(s[k]); for i := 1 to 10 do begin for j := 1 to 10 do write(ar[i, j], ' '); writeln; end; end; end; begin sovp; end.
var
i, j, r, c: byte;
ar: array[1..10, 1..10]of byte;
s: array[1..4] of string;
b: boolean;
label l1;
begin
r := random(2, 3);
l1:
c := 1;
b := false;
for i := 1 to 10 do
for j := 1 to 10 do
begin
ar[i, j] := random(0, 1);
if(i < 5) then s[i] := '';
end;
for i := 1 to 9 do
begin
for j := 1 to 10 do
begin
if(ar[i, j] <> ar[i + 1, j]) then b := true;
end;
if(b = false) then
begin
s[c] := i + ' строка совпалает с ' + (i + 1) + ' строкой';
c := c + 1;
end;
b := false;
end;
if(c <> r) then goto l1
else
begin
for var k := 1 to c do if(k<>c)then writeln(s[k]);
for i := 1 to 10 do
begin
for j := 1 to 10 do write(ar[i, j], ' ');
writeln;
end;
end;
end;
begin
sovp;
end.
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.