x21:=StrToFloat (Edit7. Text);
x22:=StrToFloat (Edit8. Text);
StringGrid1. RowCount:=SpinEdit9. Value+1;
for I:=1 to SpinEdit9. Valuedo
BEGIN
// получение случайных значений координат точки
{**************************************}
randomize;
x1:= (x12 – x11) *random+ x11;
x2:= (x22 – x21) *random+ x21;
{**************************************}
if (ComboBox1. Text='-') and (ComboBox2. Text='-') and (ComboBox3. Text='-')
then
y:=A*(x1*x1*x1) – B*(x2*x2) – C*x1 – D*x2;
if (ComboBox1. Text='-') and (ComboBox2. Text='-') and (ComboBox3. Text='+')
then
y:=A*(x1*x1*x1) – B*(x2*x2) – C*x1 + D*x2;
if (ComboBox1. Text='-') and (ComboBox2. Text='+') and (ComboBox3. Text='-')
then
y:=A*(x1*x1*x1) – B*(x2*x2) + C*x1 – D*x2;
if (ComboBox1. Text='+') and (ComboBox2. Text='-') and (ComboBox3. Text='-')
then
y:=A*(x1*x1*x1) + B*(x2*x2) – C*x1 – D*x2;
if (ComboBox1. Text='+') and (ComboBox2. Text='+') and (ComboBox3. Text='-')
then
y:=A*(x1*x1*x1) + B*(x2*x2) + C*x1 – D*x2;
if (ComboBox1. Text='-') and (ComboBox2. Text='+') and (ComboBox3. Text='+')
then
y:=A*(x1*x1*x1) – B*(x2*x2) + C*x1 + D*x2;
if (ComboBox1. Text='+') and (ComboBox2. Text='+') and (ComboBox3. Text='+')
then
y:=A*(x1*x1*x1) + B*(x2*x2) + C*x1 + D*x2;
if (ComboBox1. Text='+') and (ComboBox2. Text='-') and (ComboBox3. Text='+')
then
y:=A*(x1*x1*x1) + B*(x2*x2) – C*x1 + D*x2;
ifi=1 then
begin
x1opt:=x1;
x2opt:=x2;
Yopt:=y;
end
else
begin
if Yopt>y then
begin
x1opt:=x1;
x2opt:=x2;
Yopt:=y;
StringGrid1. Cells [4, i]:='УДАЧНАЯ';
end
else StringGrid1. Cells [4, i]:='неудачная';
end;
StringGrid1. Cells [0, i]:=inttostr(i);
StringGrid1. Cells [1, i]:=FloatToStrF (x1, ffFixed, 15, SpinEdit10. Value);
StringGrid1. Cells [2, i]:=FloatToStrF (x2, ffFixed, 15, SpinEdit10. Value);
StringGrid1. Cells [3, i]:=FloatToStrF (y, ffFixed, 15, SpinEdit10. Value);
END;
Edit9. Text:=FloatToStrF (x1opt, ffFixed, 15, SpinEdit10. Value);
Edit10. Text:=FloatToStrF (x2opt, ffFixed, 15, SpinEdit10. Value);
Edit11. Text:=FloatToStrF (Yopt, ffFixed, 15, SpinEdit10. Value);
end;
procedure TForm1. Close1Click (Sender: TObject);
begin
close;
end;
procedure TForm1.N1Click (Sender: TObject);
begin
Beep;
// показываем модально какое-нибудь окно о проге
form2. ShowModal;
end;
end.