L
likongxu
Unregistered / Unconfirmed
GUEST, unregistred user!
因为毕设要用delphi,这两天在学,按照教程编了一个关于数组的控制台程序。如下:
[blue]
program mulArray;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
A:array of array of string;
I,J:Integer;
begin
{ TODO -oUser -cConsole Main : Insert code here }
SetLength(A,10);
for I:=Low(A) to High(A) do
begin
SetLength(A,J);
for J:=Low(A) to High(A) do
begin
A[I,J]:=IntToStr(I)+','+IntToStr(J)+' ';
Write(A[I,J]);
end;
end;
Readln;
END.
[/blue]
编译时出现如下警告:
[Warning] mulArray.dpr(18): FOR-Loop variable 'J' may be undefined after loop
[Warning] mulArray.dpr(17): Variable 'J' might not have been initialized
[Warning] mulArray.dpr(15): Variable 'I' might not have been initialized
然后一个dos风格的运行窗口一闪而过,看不清结果,也不知道有没有结果。
请问这时什么原因?
[blue]
program mulArray;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
A:array of array of string;
I,J:Integer;
begin
{ TODO -oUser -cConsole Main : Insert code here }
SetLength(A,10);
for I:=Low(A) to High(A) do
begin
SetLength(A,J);
for J:=Low(A) to High(A) do
begin
A[I,J]:=IntToStr(I)+','+IntToStr(J)+' ';
Write(A[I,J]);
end;
end;
Readln;
END.
[/blue]
编译时出现如下警告:
[Warning] mulArray.dpr(18): FOR-Loop variable 'J' may be undefined after loop
[Warning] mulArray.dpr(17): Variable 'J' might not have been initialized
[Warning] mulArray.dpr(15): Variable 'I' might not have been initialized
然后一个dos风格的运行窗口一闪而过,看不清结果,也不知道有没有结果。
请问这时什么原因?