Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure ChangeMatrixRow(IndexI, IndexN, MyMatrixSize : integer);
- var
- J, RowElement, SecRowEl : integer;
- begin
- for J := 0 to MyMatrixSize do
- begin
- RowElement := Matrix[IndexI,J];
- Matrix[IndexI,J] := Matrix[IndexN,J];
- Matrix[IndexN,J] := RowElement;
- end;
- end;
- procedure Sort( MyMatrixSize : integer) ;
- var
- I, J, DiagonalElement, IndexI, IndexJ, N, M, K, PrevDiagEl : integer;
- begin
- M := 0;
- N := 0;
- PrevDiagEl := 0;
- MyMatrixSize := MyMatrixSize - 1;
- for I := 0 to MyMatrixSize-1 do
- begin
- DiagonalElement := Matrix[N,M];
- K := M;
- for J := 1 to MyMatrixSize do
- begin
- DiagonalElement := Matrix[N,K];
- if ((DiagonalElement > Matrix[i,j]) and (Matrix[i,j] >= PrevDiagEl)) then
- begin
- ChangeMatrixRow(J, N, MyMatrixSize);
- end;
- inc(k);
- end;
- PrevDiagEl := Matrix[N,M];
- Inc(M);
- Inc(N);
- end;
- Writeln;
- writeln('Результат: ');
- for i := 0 to MyMatrixSize do
- begin
- writeln;
- for j := 0 to MyMatrixSize do
- write(Matrix[i,j] : 4 );
- end;
- Readln;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement