Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- (*
- https://otvet.imgsmail.ru/download/24751000_ee2f9960b2ff9cd7b6c74ff62b4b14b1_800.png
- *)
- interface
- uses
- SysUtils, Controls, Forms, StdCtrls, Classes;
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- type
- TMatrix = array of array of Integer;
- var
- A: TMatrix;
- procedure PrintOnLabel(A: TMatrix; L: TLabel);
- var
- i, j: Integer;
- t: string;
- begin
- t := '';
- for i := Low(A) to High(A) do
- begin
- for j := Low(A[i]) to High(A[i]) do
- t := t + Format('%4d', [A[i][j]]);
- t := t + sLineBreak;
- end;
- t := TrimRight(t);
- with L do
- begin
- Font.Name := 'Courier New';
- WordWrap := False;
- Caption := t;
- AutoSize := True;
- end;
- end;
- procedure RandMatrix(var A: TMatrix);
- var
- i, j: Integer;
- begin
- Randomize;
- SetLength(A, Succ(Random(10)), Succ(Random(10)));
- for i := Low(A) to High(A) do
- for j := Low(A[i]) to High(A[i]) do
- A[i][j] := Random(101) - 50;
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- RandMatrix(A);
- PrintOnLabel(A, Label1);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement