Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program sdfdsf;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- var
- m:array [1..100,1..100] of integer;
- n,j,i,k,l,r,x, str:integer;
- begin
- writeln('vvedite kol-vo strok: ');
- readln(str);
- writeln('vvedite kol-vo stolbtsov: ');
- readln(n);
- for i:=1 to str do
- for j:=1 to n do
- readln(m[i,j]);
- writeln('Your matrix:');
- for i:=1 to n do
- begin
- for j:=1 to n do
- write(m[i,j]:3, ' ');
- writeln;
- end;
- for i:=1 to str do
- begin
- L:=2;
- r:=n;
- k:=n;
- repeat
- for j:=r downto l do
- if m[i,j-1]<m[i,j] then
- begin
- x:=m[i,j-1];
- m[i,j-1]:=m[i,j];
- m[i,j]:=x;
- k:=j;
- end;
- L:=k+1;
- for j:=L to r do
- if m[i,j-1]<m[i,j] then
- begin
- x:=m[i,j-1];
- m[i,j-1]:=m[i,j];
- m[i,j]:=x;
- k:=j;
- end;
- r:=k-1;
- until l>r;
- end;
- writeln;
- writeln('Shakernaya ubivanie po strokam:');
- for i:=1 to str do
- begin
- for j:=1 to n do
- write(m[i,j]:4, ' ');
- writeln;
- end;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement