1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
| unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, ExtCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
StringGrid1: TStringGrid;
Button2: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
i,j,x :integer;
implementation
uses unit1;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
x:=strtoint(edit1.Text);
stringgrid1.ColCount:=x+1;
stringgrid1.Rowcount:=x+1;
stringgrid1.Refresh;
for i:=1 to x do
begin
stringgrid1.cells[0,i]:='S'+inttostr(i);
stringgrid1.cells[i,0]:='S'+inttostr(i);
stringgrid1.cells[i,i]:='*****';
end;
for i:=1 to x do
for j:=1 to x do
if i<>j
then stringgrid1.cells[i,j]:=inttostr(0);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
formul:string;
begin
form1.visible:=false;
form2.visible:=true;
for i:=1 to x do
begin
formul:='dP'+inttostr(i)+'/dT=';
for j:=1 to x do
begin
if stringgrid1.cells[j,i]='1'
then formul:=formul+'-'+'λ'+inttostr(i)+inttostr(j)+'P'+inttostr(i);
if stringgrid1.cells[i,j]='1'
then formul:=formul+'+'+'λ'+inttostr(j)+inttostr(i)+'P'+inttostr(j);
end;
if formul<>'dP'+inttostr(i)+'/dT='
then form2.ListBox1.Items.Append(formul);
end;
end;
procedure TForm1.Edit1Change(Sender: TObject);
var
q:string;
begin
x:=0;
q:=edit1.Text;
for i:=1 to 100 do
if q=inttostr(i)
then
begin
x:=1;
break;
end;
if x<>1
then form1.Edit1.Text:='0';
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm2 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.DFM}
procedure TForm2.Button1Click(Sender: TObject);
begin
form1.close;
form2.close;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
form2.ListBox1.Items.Clear;
form2.visible:=false;
form1.visible:=true;
end;
end. |