0% found this document useful (0 votes)
42 views18 pages

РГР№2 по предмету: Модели и методы управления Тема: Симплекс метод пример алгоритма на языке программирования Delphi 7

The document is a Delphi program that implements the simplex method to solve linear programming problems. It contains the code for a graphical user interface that allows the user to enter the constraints and objective function of a linear program. The program then uses the simplex method algorithm to find an optimal solution. It displays the initial tableau, intermediate steps, and final optimal solution. The program can solve both profit maximization and cost minimization problems.

Uploaded by

bodauov1988
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views18 pages

РГР№2 по предмету: Модели и методы управления Тема: Симплекс метод пример алгоритма на языке программирования Delphi 7

The document is a Delphi program that implements the simplex method to solve linear programming problems. It contains the code for a graphical user interface that allows the user to enter the constraints and objective function of a linear program. The program then uses the simplex method algorithm to find an optimal solution. It displays the initial tableau, intermediate steps, and final optimal solution. The program can solve both profit maximization and cost minimization problems.

Uploaded by

bodauov1988
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

2 : : Delphi 7

: 2- 11-1 : ..

2013

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, StdCtrls, Buttons, ComCtrls, Menus; type TForm1 = class(TForm) GroupBox1: TGroupBox; Edit1: TEdit; Edit2: TEdit; BitBtn1: TBitBtn; BitBtn2: TBitBtn; Label1: TLabel; Label2: TLabel; StringGrid1: TStringGrid; Label3: TLabel; GroupBox2: TGroupBox; BitBtn4: TBitBtn; BitBtn5: TBitBtn; BitBtn6: TBitBtn; BitBtn7: TBitBtn; GroupBox3: TGroupBox; BitBtn3: TBitBtn; BitBtn8: TBitBtn; BitBtn9: TBitBtn; Edit3: TEdit; Label6: TLabel; Edit4: TEdit; Label7: TLabel; StringGrid2: TStringGrid; Label9: TLabel; Label5: TLabel; GroupBox4: TGroupBox; StringGrid3: TStringGrid; Label10: TLabel; GroupBox5: TGroupBox; StringGrid4: TStringGrid; BitBtn10: TBitBtn; BitBtn11: TBitBtn; GroupBox6: TGroupBox; Memo1: TMemo; RichEdit1: TRichEdit; Button1: TButton; Button2: TButton; Button3: TButton; RadioButton1: TRadioButton;

RadioButton2: TRadioButton; procedure BitBtn6Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure BitBtn1Click(Sender: TObject); procedure StringGrid1Click(Sender: TObject); procedure BitBtn7Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure BitBtn2Click(Sender: TObject); procedure Edit2KeyPress(Sender: TObject; var Key: Char); procedure BitBtn4Click(Sender: TObject); procedure BitBtn5Click(Sender: TObject); procedure Edit3KeyPress(Sender: TObject; var Key: Char); procedure Edit4KeyPress(Sender: TObject; var Key: Char); procedure BitBtn3Click(Sender: TObject); procedure BitBtn9Click(Sender: TObject); procedure BitBtn8Click(Sender: TObject); procedure StringGrid2Click(Sender: TObject); procedure StringGrid3KeyPress(Sender: TObject; var Key: Char); procedure BitBtn11Click(Sender: TObject); procedure BitBtn10Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure Otchistka(); begin form1.stringgrid1.RowCount :=2; form1.stringgrid1.Cells [0,form1.stringgrid1.RowCount - 1] := ''; form1.stringgrid1.Cells [1,form1.stringgrid1.RowCount - 1] := ''; form1.stringgrid2.RowCount :=2; form1.stringgrid2.Cells [0,form1.stringgrid2.RowCount - 1] := ''; form1.stringgrid2.Cells [1,form1.stringgrid2.RowCount - 1] := ''; form1.stringgrid3.RowCount :=2; form1.stringgrid2.Cells [0,form1.stringgrid2.RowCount - 1] := ''; form1.stringgrid2.Cells [1,form1.stringgrid2.RowCount - 1] := ''; form1.stringgrid3.ColCount :=2; form1.stringgrid3.RowCount :=2; end;

procedure Otvet(); var count,count2:integer; boo:boolean; begin form1.Memo1.Lines.Add(' / :'); for count:=1 to form1.StringGrid4.RowCount -1 do for count2:=0 to form1.StringGrid2.RowCount -1 do if form1.StringGrid4.Cells[0,count] = form1.StringGrid2.Cells[0,count2] then begin form1.Memo1.Lines.Add (form1.StringGrid4.Cells[0,count]+ ' ' + form1.StringGrid4.Cells[1,count]+' .'); end; boo:=false; for count:=1 to form1.StringGrid4.RowCount -1 do for count2:=0 to form1.StringGrid1.RowCount -1 do if form1.StringGrid4.Cells[0,count] = form1.StringGrid1.Cells[0,count2] then begin boo:=true; break; end; if boo then begin form1.Memo1.Lines.Add(''); form1.Memo1.Lines.Add(' :'); for count:=1 to form1.StringGrid4.RowCount -1 do for count2:=0 to form1.StringGrid1.RowCount -1 do if form1.StringGrid4.Cells[0,count] = form1.StringGrid1.Cells[0,count2] then begin form1.Memo1.Lines.Add (form1.StringGrid4.Cells[0,count]+ ' ' + form1.StringGrid4.Cells[1,count]+' .'); end; end; form1.Memo1.Lines.Add(''); if form1.RadioButton2.Checked then form1.Memo1.Lines.Add(' ' + floattostr((1)*strtofloat(form1.StringGrid4.Cells[1,1]))+' ..') else form1.Memo1.Lines.Add(' ' + form1.StringGrid4.Cells[1,1]+' ..'); end; procedure zapolni(); var Count:integer; begin form1.StringGrid3.Cells[1,0]:=''; for Count:=1 to form1.stringgrid1.RowCount-1 do begin

form1.StringGrid3.RowCount :=form1.StringGrid3.RowCount +1; form1.StringGrid3.Cells[0,Count+1]:=form1.StringGrid1.Cells[0,Count]; end; form1.StringGrid3.Cells[0,1]:=''; form1.StringGrid3.Cells[1,1]:='0'; for Count:=1 to form1.stringgrid2.RowCount-1 do begin form1.StringGrid3.ColCount := form1.StringGrid3.ColCount+1; form1.StringGrid3.Cells[Count+1,0]:=form1.StringGrid2.Cells[0,Count]; end; for Count:=1 to form1.StringGrid1.RowCount -1 do form1.StringGrid3.Cells[1,Count+1]:=form1.StringGrid1.Cells[1,Count]; for Count:=1 to form1.StringGrid2.RowCount -1 do form1.StringGrid3.Cells[Count+1,1]:=form1.StringGrid2.Cells[1,Count]; end;

procedure ZapEnd(); var Count,count2,tmp,k:integer; begin k:=1; if form1.RadioButton2.Checked then k:=-1; form1.StringGrid4.RowCount :=form1.StringGrid3.RowCount; form1.StringGrid4.ColCount := form1.StringGrid3.ColCount; for count:=0 to form1.StringGrid3.RowCount-1 do for count2:=0 to form1.StringGrid3.ColCount-1 do form1.StringGrid4.Cells [Count2,count] :=form1.StringGrid3.Cells [Count2,count]; for count:=1 to form1.StringGrid3.RowCount-1 do for count2:=1 to form1.StringGrid3.ColCount-1 do form1.StringGrid4.Cells [Count2,count] :=floattostr(k*strtofloat(form1.StringGrid3.Cells [Count2,count])); for count:=1 to form1.StringGrid4.ColCount -1 do form1.StringGrid4.Cells[count,1]:=floattostr(strtofloat(form1.StringGrid4.Cells[count,1])*(1)); tmp:=form1.StringGrid4.ColCount; form1.StringGrid4.ColCount := tmp + form1.StringGrid3.RowCount -2; for Count:=2 to form1.StringGrid3.RowCount -1 do begin form1.StringGrid4.Cells [count+tmp-2,0]:=form1.StringGrid3.Cells [0,count]; end; for count:=tmp to form1.StringGrid4.ColCount-1 do for count2:=1 to form1.StringGrid4.RowCount - 1 do if form1.StringGrid4.Cells [count,0]= form1.StringGrid4.Cells [0,count2] then form1.StringGrid4.Cells [count,count2]:='1' else form1.StringGrid4.Cells [count,count2]:='0';

end; function Proverka():boolean; var Count,Count2:integer; boo:boolean; begin boo:=true; form1.StringGrid3.Cells [1,1]:='0'; for Count:=1 to form1.StringGrid3.RowCount -1 do for Count2:=1 to form1.StringGrid3.ColCount -1 do if form1.StringGrid3.Cells [Count2,Count]='' then begin boo:=false; form1.Label5.Caption :=' . !'; end; proverka:=boo; end; procedure SimplexMetod(n:boolean); var Count,Count2,MinC,MinR:integer; MinEl,zna4,zna4TMP,zna4TMP2:double; boo,reshil:boolean; begin reshil:=false; repeat boo:=false; for count:=1 to form1.StringGrid4.ColCount -1 do if strtofloat(form1.StringGrid4.Cells [count,1])<0 then boo:=true; if boo then begin MinC:=2; zna4:=strtofloat(form1.StringGrid4.Cells [2,1]); for count:=2 to form1.StringGrid4.ColCount -1 do if strtofloat(form1.StringGrid4.Cells [count,1])<zna4 then begin zna4:=strtofloat(form1.StringGrid4.Cells [count,1]); MinC:=count; end; zna4TMP:=strtofloat(form1.StringGrid4.Cells [1,2]); zna4TMP2:=strtofloat(form1.StringGrid4.Cells [MinC,2]); MinEl:=zna4TMP/zna4TMP2; MinR:=2; for Count:=2 to form1.StringGrid4.RowCount -1 do begin zna4TMP:=strtofloat(form1.StringGrid4.Cells [1,count]); zna4TMP2:=strtofloat(form1.StringGrid4.Cells [MinC,count]);

if zna4TMP2>0 then begin zna4:=zna4TMP/zna4TMP2; if zna4<MinEl then begin MinEl:=zna4; MinR:=Count; end; end; end; MinEl:=strtofloat(form1.StringGrid4.Cells[MinC,MinR]); for count:=1 to form1.StringGrid4.ColCount -1 do form1.StringGrid4.Cells[count,MinR]:=floattostr(strtofloat(form1.StringGrid4.Cells[count,MinR])/ MinEl); for count:=1 to form1.StringGrid4.ColCount -1 do for Count2:=1 to form1.StringGrid4.RowCount -1 do if (count<>MinC)and(count2<>MinR) then form1.StringGrid4.Cells [count,count2]:=floattostr(strtofloat(form1.StringGrid4.Cells [count,count2])-strtofloat(form1.StringGrid4.Cells [count,MinR])*strtofloat(form1.StringGrid4.Cells [MinC,count2])); form1.StringGrid4.Cells[0,MinR]:=form1.StringGrid4.Cells[MinC,0]; for count:=1 to form1.StringGrid4.RowCount - 1 do if form1.StringGrid4.Cells [MinC,0]= form1.StringGrid4.Cells [0,count] then form1.StringGrid4.Cells [MinC,count]:='1' else form1.StringGrid4.Cells [MinC,count]:='0'; end else begin form1.Label5.Caption :=' !!!'; reshil:=true; end; until reshil or n; end; procedure DvSimplexMetod(n:boolean); var Count,Count2,MinC,MinR:integer; MinEl,zna4,zna4TMP,zna4TMP2:double; boo,reshil,dv:boolean; begin reshil:=false; dv:=form1.RadioButton2.Checked; repeat boo:=false; for count:=2 to form1.StringGrid4.ColCount -1 do

if strtofloat(form1.StringGrid4.Cells [count,1])<0 then boo:=true; for count:=2 to form1.StringGrid4.RowCount -1 do if strtofloat(form1.StringGrid4.Cells [1,count])<0 then boo:=true; if boo then begin MinR:=2; zna4:=strtofloat(form1.StringGrid4.Cells [1,2]); for count:=2 to form1.StringGrid4.RowCount -1 do if strtofloat(form1.StringGrid4.Cells [1,count])<zna4 then begin zna4:=strtofloat(form1.StringGrid4.Cells [1,count]); MinR:=count; end; zna4TMP:=strtofloat(form1.StringGrid4.Cells [2,1]); zna4TMP2:=strtofloat(form1.StringGrid4.Cells [2,MinR]); MinEl:=zna4TMP/zna4TMP2; MinC:=2; for Count:=2 to form1.StringGrid4.ColCount -1 do begin zna4TMP:=strtofloat(form1.StringGrid4.Cells [count,1]); zna4TMP2:=strtofloat(form1.StringGrid4.Cells [count,MinR]); if (zna4TMP>0) and (zna4TMP2<0) then begin zna4:=zna4TMP/zna4TMP2; if abs(zna4)<abs(MinEl) then begin MinEl:=zna4; MinC:=Count; end; end; end; MinEl:=strtofloat(form1.StringGrid4.Cells[MinC,MinR]); for count:=1 to form1.StringGrid4.ColCount -1 do form1.StringGrid4.Cells[count,MinR]:=floattostr(strtofloat(form1.StringGrid4.Cells[count,MinR])/ MinEl); for count:=1 to form1.StringGrid4.ColCount -1 do for Count2:=1 to form1.StringGrid4.RowCount -1 do if (count<>MinC)and(count2<>MinR) then form1.StringGrid4.Cells [count,count2]:=floattostr(strtofloat(form1.StringGrid4.Cells [count,count2])-strtofloat(form1.StringGrid4.Cells [count,MinR])*strtofloat(form1.StringGrid4.Cells [MinC,count2])); form1.StringGrid4.Cells[0,MinR]:=form1.StringGrid4.Cells[MinC,0]; for count:=1 to form1.StringGrid4.RowCount - 1 do if form1.StringGrid4.Cells [MinC,0]= form1.StringGrid4.Cells [0,count] then

form1.StringGrid4.Cells [MinC,count]:='1' else form1.StringGrid4.Cells [MinC,count]:='0'; end else begin form1.Label5.Caption :=' !!!'; reshil:=true; end; until reshil or n; end; procedure TForm1.BitBtn6Click(Sender: TObject); begin form1.Close; end; procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin case key of #8: ; #13: edit2.SetFocus ; 'a'..'z': ; 'A'..'Z': ; ''..'': ; ''..'': ; '0'..'9': ; else key:=#0; end; end; procedure TForm1.BitBtn1Click(Sender: TObject); var Count:integer; boo:boolean; begin boo:=true; if (edit1.Text ='')or(edit2.Text ='') then begin boo:=false; label5.Caption :=' .'; end; for Count := 1 to stringgrid1.RowCount do begin if (edit1.Text = stringgrid1.Cells [0,Count]) then boo:=false; end;

if boo then begin if (stringgrid1.RowCount = 2) and (stringgrid1.Cells[0,1]='') then stringgrid1.RowCount := stringgrid1.RowCount else stringgrid1.RowCount := stringgrid1.RowCount + 1; stringgrid1.Cells [0,stringgrid1.RowCount - 1] := edit1.Text; stringgrid1.Cells [1,stringgrid1.RowCount - 1] := edit2.Text; label5.Caption :=' !'; edit1.SetFocus(); end else label5.Caption :=' '; end; procedure TForm1.StringGrid1Click(Sender: TObject); var i :integer; begin i:=stringgrid1.Row; edit1.Text := stringgrid1.Cells [0,i]; edit2.Text := stringgrid1.Cells [1,i]; label5.Caption := ''; end; procedure TForm1.BitBtn7Click(Sender: TObject); var Count,i:integer; boo:boolean; begin boo:=true; for Count := 1 to stringgrid1.RowCount do begin if (edit1.Text = stringgrid1.Cells [0,Count]) then begin i:=Count; boo:=false; end; end; if boo then begin label5.Caption :=' !'; end else begin stringgrid1.Cells [0,i] := edit1.Text; stringgrid1.Cells [1,i] := edit2.Text; label5.Caption :=' .';

end; end; procedure TForm1.FormCreate(Sender: TObject); begin stringgrid1.Cells [0,0]:=''; stringgrid1.Cells [1,0]:=''; stringgrid2.Cells [0,0]:=''; stringgrid2.Cells [1,0]:=''; end; procedure TForm1.BitBtn2Click(Sender: TObject); var Count,i:integer; boo:boolean; begin boo:=true; for Count := 1 to stringgrid1.RowCount do begin if (edit1.Text = stringgrid1.Cells [0,Count]) then begin i:=Count; boo:=false; end; end; if boo then begin label5.Caption :=' !'; end else begin stringgrid1.Rows[i].Clear ; for Count := i to stringgrid1.RowCount-1 do begin stringgrid1.Cells [0,Count]:=stringgrid1.Cells [0,Count+1]; stringgrid1.Cells [1,Count]:=stringgrid1.Cells [1,Count+1]; end; stringgrid1.RowCount := stringgrid1.RowCount -1; label5.Caption :=' .'; end; end; procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char); begin case key of #8: ; #13: bitbtn1.SetFocus; '0'..'9': ; #110:;

#46:; else key:=#0; end; end; procedure TForm1.BitBtn4Click(Sender: TObject); begin label5.Caption :=''; if groupbox5.Visible = true then begin groupbox5.Visible := false; groupbox6.Visible := true; bitbtn10.Visible :=false; bitbtn11.Visible :=false; memo1.Clear(); bitbtn4.Enabled :=false; if form1.RadioButton2.Checked then dvSimplexMetod(False) else SimplexMetod(False); Otvet(); end; if groupbox4.Visible = true then begin if Proverka() then begin groupbox4.Visible := false; groupbox5.Visible := true; bitbtn10.Visible :=true; bitbtn11.Visible :=true; bitbtn4.Caption := '<>'; zapend(); end; end; if groupbox3.Visible = true then begin if stringgrid2.Cells[0,1]<>'' then begin groupbox3.Visible := false; groupbox4.Visible := true; stringgrid3.ColCount :=2; stringgrid3.RowCount :=2; zapolni(); end else label5.Caption :=' ?!';

end; if groupbox1.Visible = true then begin if stringgrid1.Cells[0,1]<>'' then begin bitbtn5.Enabled := true; groupbox1.Visible := false; groupbox3.Visible := true; end else label5.Caption :=' !'; end; end; procedure TForm1.BitBtn5Click(Sender: TObject); begin label5.Caption :=''; if groupbox3.Visible = true then begin bitbtn5.Enabled := false; groupbox3.Visible := false; groupbox1.Visible := true; end; if groupbox4.Visible = true then begin groupbox4.Visible := false; groupbox3.Visible := true; end; if groupbox5.Visible = true then begin groupbox5.Visible := false; groupbox4.Visible := true; bitbtn10.Visible :=false; bitbtn11.Visible :=false; bitbtn4.Caption := ' -->'; bitbtn4.Enabled :=true; end; if groupbox6.Visible = true then begin groupbox6.Visible := false; groupbox5.Visible := true; bitbtn10.Visible :=true; bitbtn11.Visible :=true; bitbtn4.Enabled :=true; end;

end; procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: Char); begin case key of #8: ; #13: edit4.SetFocus ; 'a'..'z': ; 'A'..'Z': ; ''..'': ; ''..'': ; '0'..'9': ; else key:=#0; end; end; procedure TForm1.Edit4KeyPress(Sender: TObject; var Key: Char); begin case key of #8: ; #13: bitbtn3.SetFocus; '0'..'9': ; #110:; #46:; else key:=#0; end; end; procedure TForm1.BitBtn3Click(Sender: TObject); var Count:integer; boo:boolean; begin boo:=true; if (edit3.Text ='')or(edit4.Text ='') then begin boo:=false; label5.Caption :=' .'; end; for Count := 1 to stringgrid2.RowCount do begin if (edit3.Text = stringgrid2.Cells [0,Count]) then boo:=false; end; if boo then begin if (stringgrid2.RowCount = 2) and (stringgrid2.Cells[0,1]='') then stringgrid2.RowCount := stringgrid2.RowCount else

stringgrid2.RowCount := stringgrid2.RowCount + 1; stringgrid2.Cells [0,stringgrid2.RowCount - 1] := edit3.Text; stringgrid2.Cells [1,stringgrid2.RowCount - 1] := edit4.Text; label5.Caption :=' !'; edit3.SetFocus(); end else label5.Caption :=' '; end; procedure TForm1.BitBtn9Click(Sender: TObject); var Count,i:integer; boo:boolean; begin boo:=true; for Count := 1 to stringgrid2.RowCount do begin if (edit3.Text = stringgrid2.Cells [0,Count]) then begin i:=Count; boo:=false; end; end; if boo then begin label5.Caption :=' !'; end else begin stringgrid2.Rows[i].Clear ; for Count := i to stringgrid2.RowCount-1 do begin stringgrid2.Cells [0,Count]:=stringgrid2.Cells [0,Count+1]; stringgrid2.Cells [1,Count]:=stringgrid2.Cells [1,Count+1]; end; stringgrid2.RowCount := stringgrid2.RowCount -1; label5.Caption :=' .'; end; end; procedure TForm1.BitBtn8Click(Sender: TObject); var Count,i:integer; boo:boolean; begin boo:=true; for Count := 1 to stringgrid2.RowCount do begin if (edit3.Text = stringgrid2.Cells [0,Count]) then

begin i:=Count; boo:=false; end; end; if boo then begin label5.Caption :=' !'; end else begin stringgrid2.Cells [0,i] := edit3.Text; stringgrid2.Cells [1,i] := edit4.Text; label5.Caption :=' .'; end; end; procedure TForm1.StringGrid2Click(Sender: TObject); var i :integer; begin i:=stringgrid2.Row; edit3.Text := stringgrid2.Cells [0,i]; edit4.Text := stringgrid2.Cells [1,i]; label5.Caption := ''; end; procedure TForm1.StringGrid3KeyPress(Sender: TObject; var Key: Char); begin case key of #8: ; #13:; '0'..'9': ; #110:; ',': ; #46:; else key:=#0; end; end; procedure TForm1.BitBtn11Click(Sender: TObject); begin if form1.RadioButton2.Checked then dvSimplexMetod(True) else SimplexMetod(True); end; procedure TForm1.BitBtn10Click(Sender: TObject);

begin if form1.RadioButton2.Checked then dvSimplexMetod(False) else SimplexMetod(False); end; procedure TForm1.Button1Click(Sender: TObject); begin Otchistka(); // stringgrid1.Cells [0,stringgrid1.RowCount - 1] := ' '; stringgrid1.Cells [1,stringgrid1.RowCount - 1] := '120'; stringgrid1.RowCount := stringgrid1.RowCount + 1; stringgrid1.Cells [0,stringgrid1.RowCount - 1] := ' '; stringgrid1.Cells [1,stringgrid1.RowCount - 1] := '280'; stringgrid1.RowCount := stringgrid1.RowCount + 1; stringgrid1.Cells [0,stringgrid1.RowCount - 1] := ' '; stringgrid1.Cells [1,stringgrid1.RowCount - 1] := '240'; stringgrid1.RowCount := stringgrid1.RowCount + 1; stringgrid1.Cells [0,stringgrid1.RowCount - 1] := ' '; stringgrid1.Cells [1,stringgrid1.RowCount - 1] := '360'; // stringgrid2.Cells [0,stringgrid2.RowCount - 1] := ''; stringgrid2.Cells [1,stringgrid2.RowCount - 1] := '10'; stringgrid2.RowCount := stringgrid2.RowCount + 1; stringgrid2.Cells [0,stringgrid2.RowCount - 1] := ''; stringgrid2.Cells [1,stringgrid2.RowCount - 1] := '14'; stringgrid2.RowCount := stringgrid2.RowCount + 1; stringgrid2.Cells [0,stringgrid2.RowCount - 1] := ''; stringgrid2.Cells [1,stringgrid2.RowCount - 1] := '12'; // zapolni(); stringgrid3.Cells [2,2] := '2'; stringgrid3.Cells [2,3] := '1'; stringgrid3.Cells [2,4] := '7'; stringgrid3.Cells [2,5] := '4'; stringgrid3.Cells [3,2] := '4'; stringgrid3.Cells [3,3] := '8'; stringgrid3.Cells [3,4] := '4'; stringgrid3.Cells [3,5] := '6'; stringgrid3.Cells [4,2] := '5'; stringgrid3.Cells [4,3] := '6'; stringgrid3.Cells [4,4] := '5'; stringgrid3.Cells [4,5] := '7'; // bitBtn5.Enabled:=true; if Proverka() then begin

groupbox1.Visible := false; groupbox5.Visible := true; bitbtn10.Visible :=true; bitbtn11.Visible :=true; bitbtn4.Caption := '<>'; zapend(); end; end; procedure TForm1.Button2Click(Sender: TObject); begin bitbtn10.Visible :=false; bitbtn11.Visible :=false; bitbtn4.Caption := ' -->'; bitbtn4.Enabled :=true; groupbox1.Visible := true; groupbox3.Visible := false; groupbox4.Visible := false; groupbox5.Visible := false; groupbox6.Visible := false; label5.Caption:=''; Otchistka(); end; procedure TForm1.Button3Click(Sender: TObject); begin application.MessageBox(' .'+ #13 +' .',' .'); end; end.

You might also like