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

📄 unit4.pas

📁 理论考试程序,可以自由下载,学习,请多多指点,批评
💻 PAS
📖 第 1 页 / 共 4 页
字号:
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(zz));
           end;

   // listbox2.Items.Add(inttostr(zz));
     end;
    end;
  //   uu:=random(257);
  //  if uu<442 then uu:=442+random(10);  //20交通信号 442-699= 257


    for i:=0 to 22  do  begin
      if  listbox2.Items.Count<70 then  begin
         uu:=random(257)+442;
        x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if uu=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(uu));
           end;

  //  listbox2.Items.Add(inttostr(uu));
      end;
     end;

    //  vv:=random(141);
  //  if vv<1066 then vv:=1066+random(20);  // 5临危处置1066-1207=141
    for i:=0 to 9 do  begin
      if  listbox2.Items.Count<75 then  begin
          vv:=1066+random(141);
           x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if vv=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(vv));
     //   listbox2.Items.Add(inttostr(vv));
     end;
     end;
     end;
   //  end;


     //   ww:=random(63);
    if ww<1208 then ww:=1208+random(10);  // 5机械常识1208-1271=63
       for i:=0 to 10 do  begin
        if  listbox2.Items.Count<80 then  begin
         ww:=random(63)+1208;
          x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
     //   listbox2.Items.Add(inttostr(vv));
     end;
    end;



  //  listbox2.Items.Add(inttostr(ww));
     end;


   //  if ww<1321 then ww:=1321+random(7); //5 1321-1390=69:货车专用  5

    for i:=0 to 30 do  begin
       if  listbox2.Items.Count<95 then  begin
         ww:=random(69)+1321;
               x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
       end;
       end;
       end;

   //     ww:=random(42);
  //  if ww<1391 then ww:=7; // 5  1272-1320=52:危险品
    for i:=0 to 15 do  begin
      if  listbox2.Items.Count<100 then  begin
               ww:=1272+random(52);
                 x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
     //   listbox2.Items.Add(inttostr(vv));
       end;
      end;

     end;
end;

if  Txtzjcx.Caption='A1、B1、A3'   then begin   //[客车]
    Randomize;  //1-441法律法规 1060-1700安全驾驶  标志标线490-690   392-441机械常识
  // 1-441:法律法规
  //442-699:道路交通信号 55
  //700-938:文明驾驶  10
  //939-1065:安全驾驶  10
 // 1066-1207:临危处置 5
  //1208-1271:机械常识 3
  //1321-1390:货车专用  5
 // 1391-1448:客车专用  5
 // 1278-1320:危险品
 // 1449-1497:轮车 10

       listbox2.Clear;
//    xx:=random(441); //法律法规 50道  441   441道题选择40道题为法律法规
    // if xx<300  then  xx:=300+random(20);
        listbox3.Clear;

    for i:= 0 to  44 do  begin    //30
     if  listbox2.Items.Count<30 then begin
         xx:=random(441);
         if xx=0 then xx:=1;
         x:=0;
        if i=0 then
        listbox2.Items.Add(inttostr(xx));
         for j:=0 to listbox2.Items.Count-1 do begin
           if xx=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(xx));
           end;
         end;
      end;
   // yy:=random(238);
  //  if yy<700 then yy:=700+random(20); //10  文明驾驶 700-938=238
    for i:=0 to 12  do  begin
       if  listbox2.Items.Count<40 then  begin
       yy:=700+random(238) ;
          x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if yy=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(yy));
           end;
        end;


 //   listbox2.Items.Add(inttostr(yy));
     end;

   //  zz:=random(62);
   // if zz<939then zz:=939+random(3);  //10安全驾驶    939-1065=62
    for i:=0 to 15  do  begin
      zz:=939+random(62);
     if  listbox2.Items.Count<45 then  begin
         x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if zz=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(zz));
           end;

   // listbox2.Items.Add(inttostr(zz));
     end;
    end;
  //  if uu<442 then uu:=442+random(10);  //20交通信号 442-699= 257


    for i:=0 to 22  do  begin
      if  listbox2.Items.Count<65 then  begin
         uu:=random(257)+442;
        x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if uu=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(uu));
           end;

  //  listbox2.Items.Add(inttostr(uu));
      end;
     end;

  //  if vv<1066 then vv:=1066+random(20);  // 5临危处置1066-1207=141
    for i:=0 to 20 do  begin
      if  listbox2.Items.Count<75 then  begin
          vv:=1066+random(141);
           x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if vv=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(vv));
     //   listbox2.Items.Add(inttostr(vv));
     end;
     end;
     end;
   //  end;


    if ww<1208 then ww:=1208+random(10);  // 5机械常识1208-1271=63
       for i:=0 to 9 do  begin
        if  listbox2.Items.Count<80 then  begin
         ww:=random(63)+1208;
          x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
     //   listbox2.Items.Add(inttostr(vv));
     end;
    end;
    end;

   //  if ww<1391 then ww:=1391+random(7); //5 1391-1448:客车专用 57
    for i:=0 to 15 do  begin
       if  listbox2.Items.Count<95 then  begin
          ww:=random(57)+1391;
          x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
     //   listbox2.Items.Add(inttostr(vv));
     end;
     end;
     end;


  //  if ww<1391 then ww:=1391+random(7); // 5  1272-1320=52:危险品
    for i:=0 to 4 do  begin
         if  listbox2.Items.Count<100 then  begin
            ww:=random(52)+1272;
              x:=0;
                for j:=0 to listbox2.Items.Count-1 do begin
                if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
    end;
   end;
  end;
end;

  if  Txtzjcx.Caption='C1、C2、C3、C4、M'   then begin   //[小型汽车]
    Randomize;  //1-441法律法规 1060-1700安全驾驶  标志标线490-690   392-441机械常识
  // 1-441:法律法规
  //442-699:道路交通信号 55
  //700-938:文明驾驶  10
  //939-1065:安全驾驶  10
 // 1066-1207:临危处置 5
  //1208-1271:机械常识 3
  //1321-1390:货车专用  5
 // 1391-1448:客车专用  5
 // 1272-1320:危险品
 // 1449-1497:轮车 10

    listbox2.Clear;
//    xx:=random(441); //法律法规 50道  441   441道题选择40道题为法律法规
    // if xx<300  then  xx:=300+random(20);
      //  listbox3.Clear;

    for i:= 0 to  80 do  begin    //30
     if  listbox2.Items.Count<30 then begin
         xx:=random(441);
         if xx=0 then xx:=1;
         x:=0;
        if i=0 then
         listbox2.Items.Add(inttostr(xx));
         for j:=0 to listbox2.Items.Count-1 do begin
           if xx=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(xx));
           end;
         end;

      end;



   // yy:=random(238);
  //  if yy<700 then yy:=700+random(20); //10  文明驾驶 700-938=238
    for i:= 0 to 30  do  begin
       if  listbox2.Items.Count<40 then  begin
       yy:=700+random(238) ;
          x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
            if yy=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(yy));
           end;
        end;

     end;

  //   zz:=random(62);
   // if zz<939then zz:=939+random(3);  //10安全驾驶    939-1065=62
    for i:=0 to 30  do  begin
      zz:=939+random(62);
     if  listbox2.Items.Count<50 then  begin
         x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if zz=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(zz));
           end;

   // listbox2.Items.Add(inttostr(zz));
     end;
    end;
   //  uu:=random(257);
  //  if uu<442 then uu:=442+random(10);  //20交通信号 442-699= 257


    for i:=0 to 32 do  begin
      if  listbox2.Items.Count<70 then  begin
         uu:=random(257)+442;
        x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if uu=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(uu));
           end;

  //  listbox2.Items.Add(inttostr(uu));
      end;
     end;

    //  vv:=random(141);
  //  if vv<1066 then vv:=1066+random(20);  // 5临危处置1066-1207=141
    for i:=0 to 30 do  begin
      if  listbox2.Items.Count<80 then  begin
          vv:=1066+random(141);
           x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if vv=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(vv));
     //   listbox2.Items.Add(inttostr(vv));
     end;
     end;
     end;
     end;
   //  end;
     //   ww:=random(63);
  //  if ww<1208 then ww:=1208+random(10);  // 5机械常识1208-1271=63  1272-1320
       for i:=0 to 20 do  begin
        if  listbox2.Items.Count<90 then  begin
         ww:=random(63)+1208;
          x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
     //   listbox2.Items.Add(inttostr(vv));
      end;
     end;
    end;


      for i:=0 to 20 do  begin
         if  listbox2.Items.Count<100 then  begin
            ww:=random(52)+1272;
              x:=0;
                for j:=0 to listbox2.Items.Count-1 do begin
                if ww=strtoint(Trim(listbox2.Items.Strings[j])) then
                x:=1;
                end;
              if x=0 then begin
            listbox2.Items.Add(inttostr(ww));
    end;
   end;
  end;


    if  (Txtzjcx.Caption='D、E、F')  then begin
   Randomize;  //1500-1721 法律法规50  标志标线  10  1722-1965 安全驾驶10  1966-2110   安全驾驶2  10 2111-2196     临危处置:10 2197-2269       2269-2299机械常识10
    listbox2.Clear;
   for i:= 0 to  50 do  begin    //35
     if  listbox2.Items.Count<35 then begin
          xx:=1500+random(221);
         x:=0;
        if i=0 then
        listbox2.Items.Add(inttostr(xx));
         for j:=0 to listbox2.Items.Count-1 do begin
           if xx=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(xx));
           end;
         end;
       end;
    //  end;

//    yy:=random(243);
  // if yy<1722 then yy:=1722+random(20); //标志标线  20  1722-1965=243
    for i:=0 to 44 do  begin
     if  listbox2.Items.Count<55 then begin
      yy:=1722+random(243);
       x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if yy=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(yy));
           end;
         end;
      end;
   //  end;

   //  zz:=random(230);
   //if zz<1966 then zz:=1966+random(20);  //安全驾驶1966-2196=230
    for i:=0 to 30 do  begin
    if  listbox2.Items.Count<75 then begin
       zz:=random(230)+1966;
        x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if zz=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(zz));
           end;

     end;
     end;
   //  end;

  //   uu:=random(72);
  //  if uu<2197 then uu:=2197+random(10);  //临危处置       2197-2269 =72
    for i:=0 to 30  do  begin
     if  listbox2.Items.Count<85 then begin
      uu:=random(72)+2197;
         x:=0;
         for j:=0 to listbox2.Items.Count-1 do begin
           if uu=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(uu));
           end;
        end;
     end;
    // end;



   //   vv:=random(30);
    if vv<2269 then vv:=2269+random(20);  //  2269-2299=机械常识10
    for i:=0 to 30 do  begin
    if  listbox2.Items.Count<100 then begin
        vv:=random(30)+2269;
           x:=0;
            for j:=0 to listbox2.Items.Count-1 do begin
              if vv=strtoint(Trim(listbox2.Items.Strings[j])) then
              x:=1;
              end;
            if x=0 then begin
            listbox2.Items.Add(inttostr(vv));
          end;
       end;
end;
end;

//exit;





//BitBtn6Click(sender);

 //end;//

{a.Enabled:=false;
b.Enabled:=false;
c.Enabled:=false;  }
bitbtn1.Enabled:=true; //程序初始化
bitbtn2.Enabled:=false;
bitbtn3.Enabled:=false;
bitbtn4.Enabled:=false;
bitbtn5.Enabled:=false;
BitBtn1Click(sender);
BitBtn6Click(sender);

end;

procedure TForm4.Timer1Timer(Sender: TObject);
var i,j,k,m:integer;
Mysysj,mz,fz:String;
begin
//秒针
// xp_button2.SetFocus;
if d>0 then begin
   d:=d-1;
if d=0 then  begin
 d:=60;
 if e<>0 then
 e:=e-1;
 end;
end;
mz:=inttostr(d);
fz:=inttostr(e);
//分针
Mysysj:='00:'+fz+':'+mz;
//Mysysj:=fz;//+':'+mz;

if Mysysj='00:0:1' then  begin
Timer1.Enabled:=false;
//Label1.Caption:='0:0';
//Label2.Caption:='0:0';
Label3.Caption:= fz+':'+mz;
//Label3.Caption:='0:0';

⌨️ 快捷键说明

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