谁能帮我看看这段代码 就是看看他是怎样循环的 谢谢啦 菜鸟帮帮我啊

jinghaijingtian jinghaijingtian 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
while choosenumber<>0 do

begin

query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select tno from ti_choose') ;
if ListBox2.Count>=1 then
begin
for mm:=1 to 9 do
begin
if TF[mm]='t' then
begin
query1.SQL.Add(' where tno not like '''+inttostr(mm)+'%''');
break;
end;
end;
if listBox2.Count>1 then
begin

for mm:=1 to 9 do
if TF[mm]='t' then
begin

query1.SQL.Add(' and tno not like '''+inttostr(mm)+'%''');
end;
end;
end;
query1.Open;
query1.First;


while not query1.Eof do
begin
hade:=false;
if i=1 then
begin

thao[i]:=((Query1.FieldValues['tno']) div 10);
end
else
if i>1 then
begin

for j:=i-1 downto 1 do
begin

if thao[j]=((Query1.FieldValues['tno']) div 10) then
begin
t:=true ;
break;
end
else
t:=false;
end;


if not t then
begin
thao[i]:=((Query1.FieldValues['tno']) div 10);
t:=false;
end;
end;

query1.Next;

if not t then
i:=i+1;
end;

temp:=random(i-1)+1;
r:=thao[temp];

q:=random(9)+1;
ran:=r*10+q;


for m:=1 to 800 do havetake[m]:=0;
for m:=1 to 800 do
begin
if havetake[m]=ran then
begin
showmessage('chongfu');
hade:=true;
break;
end;
end;
if not hade then
begin
for m:=0 to 800 do
if havetake[m]=0 then
begin
havetake[m]:=ran;
break;
end;

query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select tigan,xa,xb,xc,xd,answer,difficulty from ti_choose where tno=:no');
query1.ParamByName('no').Value:=ran;

query1.Open;

if choosenumber<>0 then
begin


if query1.RecordCount<>0 then


begin

n:= strtoint(query1.FieldByName('difficulty').AsString);
if diff[n] <>0 then
begin

tt:=tt+1;

memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
memo1.Text:=memo1.Text+query1.fieldbyname('xa').AsString+#13#10;
memo1.Text:=memo1.Text+query1.fieldbyname('xb').AsString+#13#10;
memo1.Text:=memo1.Text+query1.fieldbyname('xc').AsString+#13#10;
memo1.Text:=memo1.Text+query1.fieldbyname('xd').AsString+#13#10;
autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('answer').AsString+#13#10;
choosenumber:=choosenumber-1;
n:=n-1;
end;


end;
end;

end;

end;
progressbar1.Position:=progressbar1.Position+c;
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
jinghaijingtian
Delphi 5,944 成员 262,941 内容