Проверила с помощью F7, все считается, но полученные значения в таблицу на форме не выводятся
unit Unit11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls, Math;
type
TForm11 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
StringGrid1: TStringGrid;
Label9: TLabel;
Edit9: TEdit;
Label10: TLabel;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Button1: TButton;
Edit13: TEdit;
Label14: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form11: TForm11;
a,s,p:real;
implementation
{$R *.dfm}
function RSA(ca,cp:real):real;
Var k1,k3,n1,n3:real;
begin
k1:=strtofloat(form11.Edit1.text);
k3:=strtofloat(form11.edit3.text);
n1:=strtofloat(form11.Edit5.text);
result:=-k1*power(ca,n1)+k3*power(cp,n3);
end;
function RSS(cp,cs:real):real;
Var k2,n2,k4,n4:real;
begin
k2:=strtofloat(form11.Edit2.text);
n2:=strtofloat(form11.Edit6.text);
k4:=strtofloat(form11.Edit4.text);
n4:=strtofloat(form11.Edit8.text);
result:=k2*power(cp,n2)-k4*power(cs,n4);
end;
function RSP(ca,cp,cs:real):real;
Var k1,n1,k3,n3,k4,n4,k2,n2:real;
begin
k1:=strtofloat(form11.Edit1.text);
n1:=strtofloat(form11.Edit5.text);
k3:=strtofloat(form11.Edit3.text);
n3:=strtofloat(form11.Edit7.text);
k4:=strtofloat(form11.Edit4.text);
n4:=strtofloat(form11.Edit8.text);
k2:=strtofloat(form11.Edit2.text);
n2:=strtofloat(form11.Edit6.text);
result:=k1*power(ca,n1)-k3*power(cp,n3)-k2*power(cp,n2)+k4*power(cs,n4);
end;
procedure TForm11.Button1Click(Sender: TObject);
Var ss,a1,s1,dt,endt,t:real;
i:integer;
begin
a:=strtofloat(edit10.Text);
p:=strtofloat(edit11.Text);
s:=strtofloat(edit12.Text);
dt:=strtofloat(edit9.Text);
endt:=strtofloat(edit13.Text);
ss:=a+p+s;
while t<endt do
begin
t:=t+dt;
a1:=a+dt*RSA(a,p);
s1:=s+dt*RSS(s,p);
p:=ss-a1-s1;
a:=a1;
s:=s1;
Inc(i);
Stringgrid1.Cells[0,i]:=floattostr(t);
Stringgrid1.Cells[1,i]:=floattostr(a);
Stringgrid1.Cells[2,i]:=floattostr(p);
Stringgrid1.Cells[3,i]:=floattostr(s);
end;
end;
end.