Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit8;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls, OleCtnrs, AxCtrls, OleCtrls, VCF1;
- type
- matr = array [1..4,1..4] of real;
- TForm1 = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Panel2: TPanel;
- Button1: TButton;
- Button3: TButton;
- Button2: TButton;
- OleContainer1: TOleContainer;
- F1Book1: TF1Book;
- F1Book2: TF1Book;
- procedure Button1Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- a : matr;
- implementation
- {$R *.dfm}
- procedure TForm1.Button3Click(Sender: TObject);
- begin
- close;
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- var t : textfile; i,j : integer;
- begin
- assignfile(t,'Massive.txt');
- reset (t);
- for i := 1 to 4 do
- for j:=1 to 4 do
- begin
- read (t,a[i,j]);
- F1Book1.NumberRC[i,j] := a[i,j];
- end;
- end;
- function sum (g:matr;i : integer) : real;
- var
- j : integer;
- s : real;
- begin
- s :=0;
- for j:=1 to 4 do
- s:= g[i,j];
- sum := s;
- end;
- procedure stroki (g:matr);
- var
- i,j,k,l : integer;
- s,u :real;
- q : array [1..4] of real;
- begin
- for i:=1 to 4 do
- q[i]:=sum(a,i);
- k:=4;
- while k >1 do
- begin
- l:=1;
- for i:=2 to k do
- if q[i] > q[l] then
- l:=i;
- for j:=1 to 4 do
- begin
- s:=g[l,j];
- g[l,j] := g[k,j];
- g[k,j] := s;
- end;
- k:= k-1;
- end;
- for i:=1 to 4 do
- for j:=1 to 4 do
- Form1.F1Book2.NumberRC[i,j]:=g[i,j];
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- var i, j : integer;
- begin
- stroki(a);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement