谁能帮我看看这段代码 就是看看他是怎样循环的 谢谢啦 菜鸟帮帮我啊
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;
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;
...全文
相关推荐
C语言菜鸟基础教程之for循环
先看程序: #include <stdio> int main() { for(int i = 0; i < 5; i++) { printf(i = %d\n, i); } printf(Loop ended!\n); return 0; } 运行结果: i = 0 i = 1 i = 2 i = 3 i = 4 Loop ended! for循环的语句结构为: for(表达式1; 表达式2; 表达式3) { 语句; } 其执行顺序为: (1)执行表达式1 (2)执行表达式2。表达式2是一个判断语句;若为真,则执行{}中的语句。若为假,
for循环 范围迭代
文章目录 前言 一、pandas是什么? 二、使用步骤 1.引入库 2.读入数据 总结 前言 在学习c++/qt中的例程的时候,有如下代码 QChart *MyThemWidget::createBarChart(int valueCount) const { (void)valueCount; QChart *chart = new QChart(); chart->setTitle("Bar chart"); QS...
VBS整人代码(绝对可行,菜鸟也能玩)
里面纯代码,只需要将记事本输入代码,后面的.txt改成.vbs即可
TrintyCore菜鸟工具
用于T端简单修改配置文件使用。
android商城源码(菜鸟商城)
android商城源码,功能齐全,注释明确,是学习,二次开发的最佳选择,带数据


