Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
диссер.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
526.69 Кб
Скачать

Қосымша

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Memo1: TMemo;

procedure FormClose(Sender: TObject; var Action: TCloseAction);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form2.Close;

end;

end.

unit Unit2;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Spin,Math;

type

TForm2 = class(TForm)

GroupBox1: TGroupBox;

GroupBox2: TGroupBox;

Button1: TButton;

Label1: TLabel;

Label2: TLabel;

SpinEdit1: TSpinEdit;

SpinEdit2: TSpinEdit;

Қосымшаның жалғасы

Memo1: TMemo;

SpinEdit3: TSpinEdit;

Label3: TLabel;

Label4: TLabel;

SpinEdit4: TSpinEdit;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

type mas_integer=array of array of integer;

var

Form2: TForm2;

delitel:integer;

main_mas:mas_integer;

implementation

uses Unit1;

{$R *.dfm}

function power(var a,b:integer):integer;

begin

if (a=0) and (b=1) then

result:=1

else

result:=0;

end;

function power1(var a,b:integer):integer;

begin

if (a=0) and (b=0) then

result:=0

else

result:=1;

end;

function deleterow(var b:mas_integer; k:integer):mas_integer;

var a:mas_integer;

i,j,l:integer;

begin

setlength(a,length(b)-1,length(b[0]));

l:=0;

for i:=0 to length(b)-1 do

begin

if b[i,0]<>k then

begin

for j:=0 to length(b[i])-1 do

a[l,j]:=b[i,j];

Қосымшаның жалғасы

inc(l);

end;

end;

deleterow:=a;

end;

procedure getminandindex(var a:mas_integer;var min,i_ind,j_ind:integer);

var min_col,min_row,tempminsum,tempsum,i,j:integer;

flag:boolean;

begin

flag:=true;

for j:=1 to length(a[0])-1do

begin

tempsum:=0;

for i:=0 to length(a)-1 do

tempsum:=tempsum+a[i,j];

if flag then

begin

tempminsum:=tempsum;

min_col:=j;

flag:=false;

end

else

begin

if tempminsum>tempsum then

begin

tempminsum:=tempsum;

min_col:=j;

end;

end;

end;

min:=a[0,min_col];

for i:=0 to length(a)-1 do

if a[i,min_col]<min then

begin

min:=a[i,min_col];

end;

flag:=true;

for i:=0 to length(a)-1 do

begin

tempsum:=0;

if a[i,min_col]=min then

begin

for j:=1 to length(a[i])-1 do

tempsum:=tempsum+a[i,j];

if flag then

begin

tempminsum:=tempsum;

min_row:=i;

flag:=false;

end

Қосымшаның жалғасы

else

begin

if tempminsum>tempsum then

begin

tempminsum:=tempsum;

min_row:=i;

end;

end;

end;

end;

i_ind:=a[min_row,0];

j_ind:=min_col;

end;

procedure TForm2.Button1Click(Sender: TObject);

var i,j,k,bzmrowcount,bzmcolcount,sum:integer;

temp_str:string;

bzm,temp_mas,f_mas,f1_mas,x_mas,y_mas,main_mas_copy,v:mas_integer;

flag:boolean;

begin

Memo1.Clear;

/////////////------------------------------------------------------

setlength(main_mas,SpinEdit1.Value,SpinEdit2.Value);

randomize;

Memo1.Lines.Add('W матрицасы: ');

Memo1.Lines.Add('');

temp_str:=' ';

for i:=0 to length(main_mas[0])-1 do

temp_str:=temp_str+IntToStr(i+1)+' ';

Memo1.Lines.Add(temp_str);

temp_str:='___';

for i:=0 to length(main_mas[0])-1 do

temp_str:=temp_str+'____';

Memo1.Lines.Add(temp_str);

for i:=0 to length(main_mas)-1 do

begin

temp_str:=IntToStr(i+1) +'| ';

for j:=0 to length(main_mas[i])-1 do

begin

main_mas[i,j]:=round(random);

temp_str:=temp_str+inttostr(main_mas[i,j])+' ';

end;

Memo1.Lines.Add(temp_str);

end;

/////////////-----------------------------------------------------

bzmrowcount:=ceil(length(main_mas)/SpinEdit3.Value);

bzmcolcount:=ceil(length(main_mas[1])/SpinEdit4.Value);

setlength(bzm,bzmrowcount,bzmcolcount);

Memo1.Lines.Add('');