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

📄 d5.pas

📁 delphi编写的彩票分析程序
💻 PAS
📖 第 1 页 / 共 2 页
字号:
            //--------------以下写入文件-------------------
            memo[j].Lines.Strings[i+1]:=memo[j].Lines.Strings[i+1]+
                   intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '\' +intTostr(tempjw) + jw +' '+
                   '(' + intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ ')\' +intTostr(tempjy) + jy +' '+
                   intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '\' +IntToStr(tempcw) + cw +' '+
                   '(' + intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + ')\' +intTostr(tempcy) + cy +' ';

          end //不是最后一条结束
          else if i = Table1.RecordCount-1 then //是最后一条,只写入杀的数,不判断对错
            memo[j].Lines.Strings[i+1]:=memo[j].Lines.Strings[i+1]+
                   intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '\' +intTostr(tempjw) + '?' +' '+
                   '(' + intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ ')\' +intTostr(tempjy) + '?' +' '+
                   intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '\' +IntToStr(tempcw) + '?' +' '+
                   '(' + intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + ')\' +intTostr(tempcy) + '?' +' ';

        end;
//----------------------------------三个数 结尾--------------------------------

//-----------------------------------以下四个数开始--------------------------------------
      for a:=1 to 2 do
        for b:=(a+1) to 3 do
          for c:=(b+1) to 4 do
            for d:=(c+1) to 5 do
            begin
              tempa:=1;  tempb:=1; tempc:=1; tempd:=1; tempjy:= 1 ; tempcy:=1  ;
              for ncf:= 1 to j do
              begin
                tempa:=tempa * tab1[a];
                tempb:=tempb * tab1[b];
                tempc:=tempc * tab1[c];
                tempd:=tempd * tab1[d];
                tempjy:=tempjy * ( tab1[a] + tab1[b] + tab1[b] + tab1[d] );//(a+b+c+d);
                tempcy:=tempcy * ( tab1[a] * tab1[b] * tab1[c] * tab1[d] );//(a * b *c *d)
              end;
              //---------以上取得四种结果----以下进行取个位--------
              tempjw:=strToint(RightStr (intTostr(tempa + tempb + tempc + tempd),1) ) ;//a + b+c+d 的个位
              tempcw:=strToint(RightStr (intTostr(tempa * tempb * tempc * tempd),1) );//a * b *c*d 的个位
              tempjy:=StrToInt(RightStr(intTostr(tempjy),1)); //(a+b+c+d)的个位
              tempcy:=StrToInt(RightStr(intTostr(tempcy),1)); //(a*b*c*d)的个位
             //---------------------------------------------------------
             if i<>Table1.RecordCount-1 then//不是最后一条,要进行检验
             begin// 不是最后一条开始
               for k:=1 to 3 do //
                 if tempjw = tab2[k] then
                 begin
                   jw:='x';
                   Break;
                 end
                 else
                   jw:='v';

               for k:=1 to 3 do //
                 if tempjy = tab2[k] then
                 begin
                   jy:='x';
                   Break;
                 end
                 else
                   jy:='v';

               for k:=1 to 3 do //
                 if tempcw = tab2[k] then
                 begin
                   cw:='x';
                   Break;
                 end
                 else
                   cw:='v';

               for k:=1 to 3 do //
                 if tempcy = tab2[k] then
                 begin
                   cy:='x';
                   Break;
                 end
                 else
                   cy:='v';
            //--------------以下写入文件-------------------
              memo[j].Lines.Strings[i+1]:=memo[j].Lines.Strings[i+1]+
                   intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d)+'\' +intTostr(tempjw) + jw +' '+
                   '(' + intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d) + ')\' +intTostr(tempjy) + jy +' '+
                   intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d) +'\' +IntToStr(tempcw) + cw +' '+
                   '(' + intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d)+ ')\' +intTostr(tempcy) + cy +' ';

            end //不是最后一条结束
            else if i = Table1.RecordCount-1 then //是最后一条,只写入杀的数,不判断对错
              memo[j].Lines.Strings[i+1]:=memo[j].Lines.Strings[i+1]+
                   intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d)+'\' +intTostr(tempjw) + '? '+
                   '(' + intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d) + ')\' +intTostr(tempjy) +'? '+
                   intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d) +'\' +IntToStr(tempcw) + '? '+
                   '(' + intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d)+ ')\' +intTostr(tempcy) + '? ';

        end;
//-----------------------------------四个数  结尾--------------------------------------

//-----------------------------------五个数  开始--------------------------------------------
        begin
              tempa:=1;  tempb:=1; tempc:=1; tempd:=1;tempe:=1; tempjy:= 1 ; tempcy:=1  ;
              for ncf:= 1 to j do
              begin
                tempa:=tempa * tab1[a];
                tempb:=tempb * tab1[b];
                tempc:=tempc * tab1[c];
                tempd:=tempd * tab1[d];
                tempe:=tempe * tab1[e];
                tempjy:=tempjy * ( tab1[a] + tab1[b] + tab1[b] + tab1[d] + tab1[e] );//(a+b+c+d+e);
                tempcy:=tempcy * ( tab1[a] * tab1[b] * tab1[c] * tab1[d] + tab1[e] );//(a * b *c *d *e)
              end;
              //---------以上取得四种结果----以下进行取个位--------
              tempjw:=strToint(RightStr (intTostr(tempa + tempb + tempc + tempd +tempe),1) ) ;//a + b+c+d +e的个位
              tempcw:=strToint(RightStr (intTostr(tempa * tempb * tempc * tempd * tempe),1) );//a * b *c*d*e 的个位
              tempjy:=StrToInt(RightStr(intTostr(tempjy),1)); //(a+b+c+d+e)的个位
              tempcy:=StrToInt(RightStr(intTostr(tempcy),1)); //(a*b*c*d*e)的个位
             //---------------------------------------------------------
             if i<>Table1.RecordCount-1 then//不是最后一条,要进行检验
             begin// 不是最后一条开始
               for k:=1 to 3 do //
                 if tempjw = tab2[k] then
                 begin
                   jw:='x';
                   Break;
                 end
                 else
                   jw:='v';

               for k:=1 to 3 do //
                 if tempjy = tab2[k] then
                 begin
                   jy:='x';
                   Break;
                 end
                 else
                   jy:='v';

               for k:=1 to 3 do //
                 if tempcw = tab2[k] then
                 begin
                   cw:='x';
                   Break;
                 end
                 else
                   cw:='v';

               for k:=1 to 3 do //
                 if tempcy = tab2[k] then
                 begin
                   cy:='x';
                   Break;
                 end
                 else
                   cy:='v';
            //--------------以下写入文件-------------------
              memo[j].Lines.Strings[i+1]:=memo[j].Lines.Strings[i+1]+
                   intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d)+ '+' +intTostr(e)+'\' +intTostr(tempjw) + jw +' '+
                   '(' + intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d) + '+'+intTostr(e)+ ')\' +intTostr(tempjy) + jy +' '+
                   intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d) + '*'+intTostr(e)+'\' +IntToStr(tempcw) + cw +' '+
                   '(' + intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d)+ '*'+intTostr(e)+ ')\' +intTostr(tempcy) + cy +' ';

            end //不是最后一条结束
            else if i = Table1.RecordCount-1 then //是最后一条,只写入杀的数,不判断对错
              memo[j].Lines.Strings[i+1]:=memo[j].Lines.Strings[i+1]+
                   intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d)+ '+' +intTostr(e)+'\' +intTostr(tempjw) + '? '+
                   '(' + intTostr(a)+ '+' +intTostr(b)+ '+' + intTostr(c)+ '+' +intTostr(d) + '+'+intTostr(e)+ ')\' +intTostr(tempjy) + '? '+
                   intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d) + '*'+intTostr(e)+'\' +IntToStr(tempcw) + '? '+
                   '(' + intTostr(a)+ '*' +intTostr(b)+ '*' + intTostr(c) + '*' +intTostr(d)+ '*'+intTostr(e)+ ')\' +intTostr(tempcy) + '? ';

        end;         

//-----------------------------------五个数  结束--------------------------------------------
    end; //------1__9  结束---------------------------------


  end;//---------for 总条数 end-------------------------------------------------

  memo[1].Lines.Strings[i+1]:=' ';//使memo1的记录回到第开始(1+2),为了美观
  Label2.Caption:='程序已经进行了'+intTostr(Table1.RecordCount * 104)+'次运算,共得出'+
                  intTostr(Table1.RecordCount * 104 * 9)+'种结果';
end;//--------条数比1 大 结尾------------
end;

procedure TForm1.addClick(Sender: TObject);
begin
  if add.Caption='增加号码' then
  begin
    table1.Edit;
    Table1.Append;
    add.Caption:='保存号码';
  end
  else if add.Caption='保存号码' then
  begin
    table1.Edit;
    table1.Post;
    add.Caption:='增加号码';
  end;

end;

procedure TForm1.delClick(Sender: TObject);
begin
  table1.Delete;
end;

procedure TForm1.saveClick(Sender: TObject);
begin
  if SaveDialog1.Execute then
  begin
    case PageControl1.ActivePageIndex of
    0:memo1.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    1:memo2.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    2:memo3.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    3:memo4.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    4:memo5.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    5:memo6.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    6:memo7.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    7:memo8.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    8:memo9.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
    end;
  end;
end;

procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then
    DBGrid1.SelectedIndex:= DBGrid1.SelectedIndex+1;

end;

end.

⌨️ 快捷键说明

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