⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit18.pas

📁 毕业设计(带论文)—试卷生成系统,做的不错
💻 PAS
📖 第 1 页 / 共 4 页
字号:
      end;
   if ComboBox1.ItemIndex=0 then
      begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.add('select tno from ti_filltext 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_filltext 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_filltext 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_filltext 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_filltext 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_filltext 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_filltext 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_filltext 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_filltext 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,ka,kb,kc,kd,difficulty from ti_filltext where tno=:no');
    query1.ParamByName('no').Value:=ran;

    query1.Open;

    if filltextnumber<>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
            tt:=tt+1;

      //  memo1.Text:=memo1.Text+'填空题';
 // 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('ka').AsString+#13#10;

          if query1.fieldbyname('kb').AsString<>'' then
             autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.fieldbyname('kb').AsString+#13#10;
//form.Memo1.Text:=madeanswerform.Memo1.Text+#10+'   '+query1.fieldbyname('kb').AsString+' '+#13;
 if query1.fieldbyname('kc').AsString<>'' then
   autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.fieldbyname('kc').AsString+#13#10;
 //madeanswerform.Memo1.Text:=answerform.Memo1.Text+#10+'   '+query1.fieldbyname('kc').AsString+' '+#13;
 if query1.fieldbyname('kd').AsString<>'' then
    autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.fieldbyname('kd').AsString+#13#10;
 //madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#10+'   '+query1.fieldbyname('kd').AsString+' '+#13;
    filltextnumber:=filltextnumber-1;
     n:=n-1;
   // strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
       end;


        end;
       end;
 //i:=thao[]


       end;


  //       showmessage('filltextstop');
        end;
        progressbar1.Position:=progressbar1.Position+f;

  if definepaperform.DBEdit5.Text<>'0' then
begin
     tt:=0;
   paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10+tmno[pp]+'程序阅读题'+'(共'+definepaperform.DBEdit5.Text+'小题,每题'+definepaperform.DBEdit8.Text+'分,小计'+definepaperform.DBEdit11.Text+'分).'+#13#10+'';

  autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'程序阅读题:'+#13#10+'';
    pp:=pp+1;
end;


       //程序阅读
       //------------------------------------------------------------------------
       //---------------------------------------------------------------------------
        while readpronumber<>0 do
        begin




        query1.Close;
       query1.SQL.Clear;
       query1.SQL.Add('select tno from ti_readpro') ;
       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('readprobegib');
      if ComboBox1.ItemIndex=-1 then
      begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.add('select tno from ti_readpro');
   query1.Open;
   query1.First;
      end;
   if ComboBox1.ItemIndex=0 then
      begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.add('select tno from ti_readpro 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_readpro 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_readpro 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_readpro 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_readpro 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_readpro 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_readpro 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_readpro 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_readpro 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,ctigan1,x1a,x1b,x1c,x1d,ctigan2,x2a,x2b,x2c,x2d,ctigan3,x3a,x3b,x3c,x3d,answer1,answer2,answer3,difficulty from ti_readpro where tno=:no');
    query1.ParamByName('no').Value:=ran;

    query1.Open;

    if readpronumber<>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

            tt:=tt+1;
           // memo1.Text:=memo1.Text+'程序阅读题';
 //  showmessage(inttostr(ran));
    memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
     memo1.Text:=memo1.Text+query1.fieldbyname('ctigan1').AsString+#13#10;

     memo1.Text:=memo1.Text+query1.fieldbyname('x1a').AsString+#13#10;
     memo1.Text:=memo1.Text+query1.fieldbyname('x1b').AsString+#13#10;
     memo1.Text:=memo1.Text+query1.fieldbyname('x1c').AsString+#13#10;
     memo1.Text:=memo1.Text+query1.fieldbyname('x1d').AsString+#13#10;
     if query1.FieldByName('ctigan2').AsString<>'' then
     begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -