📄 unit18.pas
字号:
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_choose where tno not like ''9%%%''');
query1.Open;
query1.First;
end;
}
while not query1.Eof do
begin
hade:=false;
if i=1 then
begin
thao[i]:=((Query1.FieldValues['tno']) div 10);
// memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
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);
// memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
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;
// if m=1 then
// havetake[1]:=0000;
// else if
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;
// showmessage(inttostr(ran));
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 //continue //showmessage('ddd')
// else
begin
n:= strtoint(query1.FieldByName('difficulty').AsString);
if diff[n] <>0 then
// if definediff[strtoint(query1.fieldbyname('difficulty').AsString)]<>0 then
begin
// memo1.Text:=memo1.Text+'选择题';
tt:=tt+1;
// showmessage(inttostr(ran));
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;
// strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
end;
end;
end;
//i:=thao[]
end;
// showmessage('choosestop');
end;
progressbar1.Position:=progressbar1.Position+c;
//判断题
// showmessage('ce');
//-----------------------------------------------------------
//--------------------------------------------------------------
if definepaperform.DBEdit4.Text<>'0' then
begin
tt:=0;
paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10+tmno[pp]+'判断题'+'(共'+definepaperform.DBEdit4.Text+'小题,每题'+definepaperform.DBEdit7.Text+'分,小计'+definepaperform.DBEdit10.Text+'分).'+#13#10+'';
autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'判断题: '+#13#10+'';
pp:=pp+1;
end;
while judgenumber<>0 do
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select tno from ti_judge') ;
if ListBox2.Count>=1 then
begin
// if ListBox2.Count=1 then
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)+'%''');
// showmessage(query1.SQL.Text);
end;
end;
end;
query1.Open;
query1.First;
{
// showmessage('judgebegin');
if ComboBox1.ItemIndex=-1 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=0 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''1%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=1 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''2%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=2 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''3%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=3 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''4%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=4 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''5%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=5 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''6%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=6 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''7%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=7 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''8%%%''');
query1.Open;
query1.First;
end;
if ComboBox1.ItemIndex=8 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_judge where tno not like ''9%%%''');
query1.Open;
query1.First;
end;
}
while not query1.Eof do
begin
hade:=false;
if i=1 then
begin
thao[i]:=((Query1.FieldValues['tno']) div 10);
// memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
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);
// memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
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;
// if m=1 then
// havetake[1]:=0000;
// else if
for m:=1 to 800 do havetake[m]:=0;
for m:=1 to 800 do
begin
if (havetake[m] div 10)=r 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;
// showmessage(inttostr(ran));
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select tigan,answer,difficulty from ti_judge where tno=:no');
query1.ParamByName('no').Value:=ran;
query1.Open;
if judgenumber<>0 then
begin
if query1.RecordCount<>0 then //continue//showmessage('ddd')
// else
begin
n:= strtoint(query1.FieldByName('difficulty').AsString);
if diff[n] <>0 then
// if definediff[strtoint(query1.fieldbyname('difficulty').AsString)]<>0 then
begin
// memo1.Text:=memo1.Text+'判断题';
tt:=tt+1;
// showmessage(inttostr(ran));
memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('answer').AsString+#13#10;
judgenumber:=judgenumber-1;
n:=n-1;
// strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
end;
end;
end;
//i:=thao[]
end;
// showmessage('judgestop');
end;
progressbar1.Position:=progressbar1.Position+ju;
if definepaperform.DBEdit12.Text<>'0' then
begin
tt:=0;
paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10#13#10+tmno[pp]+'填空题'+'(共'+definepaperform.DBEdit12.Text+'小题,每题'+definepaperform.DBEdit13.Text+'分,小计'+definepaperform.DBEdit14.Text+'分).'+#13#10+'';
autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'填空题: '+#13#10+'';
pp:=pp+1;
end;
//填空题
//----------------------------------------------------------------
//----------------------------------------------------------------------
while filltextnumber<>0 do
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select tno from ti_filltext') ;
if ListBox2.Count>=1 then
begin
// if ListBox2.Count=1 then
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)+'%''');
// showmessage(query1.SQL.Text);
end;
end;
end;
query1.Open;
query1.First;
{
// showmessage('filltextbegin');
if ComboBox1.ItemIndex=-1 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select tno from ti_filltext');
query1.Open;
query1.First;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -