
30.03.2014, 20:42
|
Прохожий
|
|
Регистрация: 30.03.2014
Сообщения: 7
Версия Delphi: Delphi 7
Репутация: 10
|
|
Возникли вопросы при изучении Delphi
Доброго времени суток, Delphi занимаюсь совсем недавно до этого был только базовый курс basic, испытываю большие трудности в программировании, так что за кривизну кода простите.
проблема в том, что массив не хочет считаться с плавающей запятой, хотя и задан в Real, прошу помочь, будьте добры
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Edit9: TEdit;
Label12: TLabel;
Button1: TButton;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label13: TLabel;
StringGrid1: TStringGrid;
Edit10: TEdit;
Label14: TLabel;
Label18: TLabel;
Edit11: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Qor, Qimr, H, x, y, R, t0, Qhr, Qe, Qh, Qh1, q, q1, B, C, Qbr, Knom: Real;
k : array[1..24] of real;
i: integer;
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
for i:= 1 to 24 do
if Length(StringGrid1.Cells[i, 0]) <>0
then k[i] := StrToInt(StringGrid1.Cells[i,0])
else k[i] := 0;
Qor := StrTOFloat(Edit1.Text);
Qimr := StrTOFloat(Edit2.Text);
H := StrTOFloat(Edit3.Text);
x := StrTOFloat(Edit4.Text);
y := StrTOFloat(Edit5.Text);
R := StrTOFloat(Edit6.Text);
t0 := StrTOFloat(Edit7.Text);
Qhr := StrTOFloat(Edit8.Text);
Qe := StrTOFloat(Edit9.Text);
Qbr := StrTOFloat(Edit10.Text);
Knom := StrTOFloat(Edit11.Text);
if (RadioButton1.Checked=True) then
begin
for i:=1 to 24 do
Qh := Qe+Qor*((1+R*Exp(2*ln(k[i])))/(1+R))+H*exp(y*ln(k[i]));
Qh1 := Qe+Qor*((1+R*Exp(2*ln(k[i])))/(1+R));
Label13.Caption:=FloatToStr(Qh1);
Label17.Caption:=FloatToStr(Qh);
end;
if (RadioButton2.Checked=True) then
begin
for i:=1 to 24 do
Qh :=Qe+Qhr*((1+R*Exp(2*ln(k[i])))/(1+R))+2*(Qimr-36)*Exp(y*ln(k[i]))+H*Exp(y*ln(k[i]));
Qh1 :=Qe+Qhr*((1+R*Exp(2*ln(k[i])))/(1+R))+2*(Qimr-36)*Exp(y*ln(k[i]));
Label13.Caption:=FloatToStr(Qh1);
Label17.Caption:=FloatToStr(Qh);
end;
if (RadioButton3.Checked=True) then
begin
for i:=1 to 24 do
Qh :=Qe+Qhr*((1+R*Exp(2*ln(k[i])))/(1+R))+2*(Qimr-36)*Exp(y*ln(k[i]))+H*Exp(y*ln(k[i]));
q :=Qh+0.15*(Qh-Qhr);
Qh1 :=Qe+Qhr*((1+R*Exp(2*ln(k[i])))/(1+R))+2*(Qimr-36)*Exp(y*ln(k[i]));
q1 :=Qh1+0.15*(Qh1-Qhr);
Label13.Caption:=FloatToStr(q1);
Label17.Caption:=FloatToStr(q);
end;
end;
end.
|