急,急!一个关于动态二维数组运算的问题。(0分)

  • 主题发起人 主题发起人 yanke
  • 开始时间 开始时间
Y

yanke

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure formdestroy(sender: Tobject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
var
myedit: array[1..5] of tedit;
myedit1:array[1..5] of tedit;
myedit2:array[1..5] of tedit;
myedit3:array[1..5] of tedit;
r: array[1..5] of real;
es:array[1..5] of real;
d:array[0..5] of real;
thick:array[1..5] of real;
depth1: array of array of real;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
i:integer;
begin
for i:=1 to 5 do
begin
myedit:=TEdit.Create(self);
myedit.Parent:=self;
myedit.Top:=32+(i-1)*24;
myedit.Left:=280;
myedit.Width:=50;
myedit1:=TEdit.Create(self);
myedit1.Parent:=self;
myedit1.Top:=32+(i-1)*24;
myedit1.Left:=336;
myedit1.Width:=50;
myedit2:=TEdit.Create(self);
myedit2.Parent:=self;
myedit2.Top:=32+(i-1)*24;
myedit2.Left:=392;
myedit2.Width:=50;
myedit3:=TEdit.Create(self);
myedit3.Parent:=self;
myedit3.Top:=32+(i-1)*24;
myedit3.Left:=448;
myedit3.Width:=50;
end;
end;
procedure Tform1.FormDestroy(Sender: TObject);
var
i:integer;
begin
for i:=1 to 5 do
begin
myedit.Free;
myedit1.Free;
myedit2.Free;
myedit3.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
begin
setlength(depth1,5);
setlength(depth1[2],3);
for i:=1 to 5 do
begin
r:=strtofloat (myedit1.Text);
d:=strtofloat(myedit2.Text);
es:=strtofloat(myedit3.Text);
d[0]:=0;
thick:=d-d[i-1];
end;
for i:=1 to 5 do
begin
for j:=1 to 3 do
begin
depth1[i,j]:=d[i-1]+ thick/3*(j-1/2);******
end;
end;
end;
end.
depth1是一个动态二维数组,******句运行时出现错误,是不是动态二维数组不能如此运算,
请帮我指出正确的计算方法,我很急,请帮帮忙,谢谢!
 
后退
顶部