需求:循环完毕,数组ti[i,1]里面有100个数
下面的代码错误之处望大虾不吝指教。 for i := 1 to 100 do
begin
tempf := 0;
while tempf=0 do
begin
Randomize;
temp := random(max);
for j := 1 to i do
begin
if ti[j, 1] = temp then
begin
tempf := 0;
Break;
end;
Next;
end;
Break;
end;
ti[i, 1] := temp;
ti[i, 3] := 0;
ti[i, 2] := 0;
ti[i, 4] := 0;
Next;
end;
下面的代码错误之处望大虾不吝指教。 for i := 1 to 100 do
begin
tempf := 0;
while tempf=0 do
begin
Randomize;
temp := random(max);
for j := 1 to i do
begin
if ti[j, 1] = temp then
begin
tempf := 0;
Break;
end;
Next;
end;
Break;
end;
ti[i, 1] := temp;
ti[i, 3] := 0;
ti[i, 2] := 0;
ti[i, 4] := 0;
Next;
end;
解决方案 »
- 如何把ExcelApplication1 或是CreateOleObject( 'Excel.Application' ) 打开的EXCEL 放到我自已的窗体容器中。
- 关于控件安装的简单问题
- 如何释放用SetLength()分配的内存
- 如何隐藏listview中的指定的行?
- 散分,行善!
- 什么打印控件可以在运行时允许用户调整打印的位置?
- DBGrid会自动保存修改的内容?
- 数据库连接的问题?
- Delphi编写程序时,按什么键可以查找begin ... end 的配对.(如C++ 中ALT+{ )
- 用advstringgrid隔行求和
- 有哪位大哥用过VSFlexGrid控件么?听说很不错,但是我用的时候发现有个很不方便的地方,不知道是不是它本身的缺陷!
- 寻找mdMailSlot.pas ;RxHints.pas两个文件!
for j := 1 to i do也没看出能做什么用,后面反正要赋值ti[i, 1] := temp;
while tempf=0 do
都等于0了还判断啥啊?next也不对
………………………………………………………………Delphi帮助里面怎么没有这个说明?另外,楼主最好把自己的意图写出来,这个东西不知道是干什么用的,也无所谓错误不错误了。
begin
if (FFormStyle = fsMDIForm) and (ClientHandle <> 0) then
SendMessage(ClientHandle, WM_MDINEXT, 0, 0);
end;
begin
if (FormStyle = fsMDIForm) and (ClientHandle <> 0) then
SendMessage(FClientHandle, WM_MDINEXT, 0, 1);
end;
var
i: integer;
a: Array[0..99] of Integer;
begin
Randomize;
for i:=Low(a) to High(a) do
a[i] := random(100);
end;
var
i, j, t: integer;
a: Array[0..99] of Integer;
const
max: integer = 1000;
begin
Randomize;
for i:=Low(a) to High(a) do
a[i] := -1;
for i:=Low(a) to High(a) do
begin
t := Random(max);
while true do
begin
for j:=Low(a) to High(a) do
begin
if a[j]=t then
break;
end;
if j>High(a) then
break
else
t := Random(max);
end;
a[i] := t;
end;
end;