Ўзбекистон алоқа ва ахборотлаштириш агентлиги тошкент ахборот технологиялари университети самарқанд филиали


Download 273.5 Kb.
bet5/6
Sana16.06.2023
Hajmi273.5 Kb.
#1492996
1   2   3   4   5   6
Bog'liq
4-лаборатория

Tozalash tugmasi:

procedure TForm1.Button3Click(Sender: TObject);


var i,j:integer;
begin
Label3.Caption:='';
Label4.Caption:='';
Label7.Caption:='';
for i:=1 to StringGrid1.ColCount-1 do
for j:=1 to StringGrid1.RowCount-1 do
StringGrid1.Cells[i,j]:='';
end;


Operatsiyalar soni:

procedure TForm1.SpinEdit1Change(Sender: TObject);


var i:integer;
begin
StringGrid1.ColCount:=SpinEdit1.Value+1;
for i:=1 to SpinEdit1.Value do
StringGrid1.Cells[i,0]:='P'+IntToStr(i);
end;
unit Unit1;

interface


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


Dialogs, Grids, ExtCtrls, Menus, StdCtrls, Spin, XPMan;

type
TForm1 = class(TForm)


Panel1: TPanel;
Panel2: TPanel;
StringGrid1: TStringGrid;
MainMenu1: TMainMenu;
Fayl1: TMenuItem;
Chiqish1: TMenuItem;
Muallif1: TMenuItem;
Dasturhaqida1: TMenuItem;
SpinEdit1: TSpinEdit;
Button1: TButton;
GroupBox1: TGroupBox;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Button2: TButton;
Label5: TLabel;
GroupBox2: TGroupBox;
Label7: TLabel;
Button3: TButton;
XPManifest1: TXPManifest;
procedure Chiqish1Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Dasturhaqida1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;


implementation


{$R *.dfm}


procedure TForm1.Chiqish1Click(Sender: TObject);


begin
Close;
end;

procedure TForm1.SpinEdit1Change(Sender: TObject);


var i:integer;
begin
StringGrid1.ColCount:=SpinEdit1.Value+1;
for i:=1 to SpinEdit1.Value do
StringGrid1.Cells[i,0]:='P'+IntToStr(i);
end;

procedure TForm1.FormCreate(Sender: TObject);


var i:integer;
begin
StringGrid1.Cells[0,1]:='M1';
StringGrid1.Cells[0,2]:='M2';
for i:=1 to SpinEdit1.Value do
StringGrid1.Cells[i,0]:='P'+IntToStr(i);
end;

procedure TForm1.Button1Click(Sender: TObject);


var
b:boolean;
s1,s2,s3,s4,s5:string;
i,i1,j,k,m,n,min:integer;
a:array[1..2,1..100] of integer;
st:set of byte;
f,l:integer;
ss,sb:array[1..100] of string;
begin
Label3.Caption:='';
Label4.Caption:='';
Label7.Caption:='';
f:=1;
l:=1;
st:=[0];
for i:=1 to 2 do
for j:=1 to StringGrid1.ColCount-1 do
a[i,j]:=StrToInt(StringGrid1.Cells[j,i]);

b:=true;
m:=StringGrid1.ColCount-1;


s1:='';
s2:='';
s3:='';
for i:=1 to m do
begin
k:=1;
while ((k in st)) do
begin
inc(k);
if k=m then break;
end;
n:=k;

if b then min:=a[1,k] else min:=a[2,k];


for j:=1 to m do


begin
if b then
if (a[1,j]begin
min:=a[1,j];
n:=j;
end;

if not b then


if (a[2,j]begin
min:=a[2,j];
n:=j;
end;

end;

if b then
begin
sb[l]:=inttostr(min);
inc(l);
s1:=s1+inttostr(min)+', ';
s4:=s4+'P'+inttostr(n)+', ';
end

else
begin


ss[f]:=inttostr(min);
inc(f);
s2:=s2+inttostr(min)+', ';
s5:=s5+' ,'+inttostr(n)+'P';
end;

st:=st+[n];


b:=not b;


end;

Label3.Caption:=s1;
Label4.Caption:=s2;
for i:=f-1 downto 1 do
s3:=s3+ss[i]+', ';
Label7.Caption:=Label7.Caption+s4;
for i:=Length(s5) downto 1 do
Label7.Caption:=Label7.Caption+s5[i];

end;

procedure TForm1.Button2Click(Sender: TObject);
var
i,j:integer;
begin
for i:=1 to StringGrid1.ColCount-1 do
for j:=1 to 2 do
StringGrid1.Cells[i,j]:=inttostr(random(30));

end;

procedure TForm1.Button3Click(Sender: TObject);
var i,j:integer;
begin
Label3.Caption:='';
Label4.Caption:='';
Label7.Caption:='';
for i:=1 to StringGrid1.ColCount-1 do
for j:=1 to StringGrid1.RowCount-1 do
StringGrid1.Cells[i,j]:='';
end;

procedure TForm1.Dasturhaqida1Click(Sender: TObject);


begin
ShowMessage('Dastur muallifi: 4 - kurs talabasi Rabbimov Murod');
end;

end.


Download 273.5 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling