L
ldwolf
Unregistered / Unconfirmed
GUEST, unregistred user!
此前定义了一数组NUM[1。。10],全部赋初值为零,
procedure tform1.getnum(n:integer);//确定随机数的代码部分
begin
if (n=0) or (not num[n]=0) then
begin
n:=random(10);
getnum;
end
else //not n=0
if (not n=0) and (num[n]=0) then
num[n]:=n;
end;
procedure TForm5.Button1Click(Sender: TObject);//将选出的题放入MEMO中
var
i,r,j:integer;
begin
for i:=1 to 5 do
begin
randomize;
r:=random(10);
getnum(r);
table1.locate('number',r,[]);
for j:=1 to table1.fieldcount-1 do
form6.memo1.lines.add(form1.table1.fields[j].asstring);
end;
form6.showmodal;
end;
procedure tform1.getnum(n:integer);//确定随机数的代码部分
begin
if (n=0) or (not num[n]=0) then
begin
n:=random(10);
getnum;
end
else //not n=0
if (not n=0) and (num[n]=0) then
num[n]:=n;
end;
procedure TForm5.Button1Click(Sender: TObject);//将选出的题放入MEMO中
var
i,r,j:integer;
begin
for i:=1 to 5 do
begin
randomize;
r:=random(10);
getnum(r);
table1.locate('number',r,[]);
for j:=1 to table1.fieldcount-1 do
form6.memo1.lines.add(form1.table1.fields[j].asstring);
end;
form6.showmodal;
end;