A
awryk63
Unregistered / Unconfirmed
GUEST, unregistred user!
我编了一段程序,编译不了,是不是动态数组有错?程序如下:
procedure TForm1.Button1Click(Sender: TObject);
var
fx:Textfile;
i,j,n,m:Integer;
a:array of array of Integer;
begin
n:=3;
m:=9;
SetLength(a,n,m);
AssignFile(fx,'aa.txt');
Reset(fx);
for i:=1 to n do
for j:=1 to m do
Read(fx,a[i,j]);
Edit1.Text:=IntToStr(a[3,6]);
closefile(fx);
end;
文件aa.txt的内容如下:
1 2 3 4 5 6 7 8 9
2 3 4 5 6 7 8 9 1
3 4 5 6 7 8 9 1 2
[?][?][?][?][?][?][?][?][?][?][?][?][?][?][?]
procedure TForm1.Button1Click(Sender: TObject);
var
fx:Textfile;
i,j,n,m:Integer;
a:array of array of Integer;
begin
n:=3;
m:=9;
SetLength(a,n,m);
AssignFile(fx,'aa.txt');
Reset(fx);
for i:=1 to n do
for j:=1 to m do
Read(fx,a[i,j]);
Edit1.Text:=IntToStr(a[3,6]);
closefile(fx);
end;
文件aa.txt的内容如下:
1 2 3 4 5 6 7 8 9
2 3 4 5 6 7 8 9 1
3 4 5 6 7 8 9 1 2
[?][?][?][?][?][?][?][?][?][?][?][?][?][?][?]