毕业设计要做一个彩票号码管理的程序,再数据库中彩票号是这样的 0102030405
但是在程序中要求两个号码中有空格比如: 01  02  03  04  05  
请问该如何解决。

解决方案 »

  1.   

    你这小子,真走运,我前些天买了彩标,是21选5的,今天也买了,
    特意做了个统计号的程序。
    其实也很简单。你分别取。var
    s,s1:string;
    i:integer;
    begin
    s:='01 02 03 04 05' 
    //用copy函数处理.统计For i:=0 to length(s) do
    begin
     s1:= copy(s,i+2,2);
    end;
    //就这么一个个的取. 然后全部存到数据库,分析图表。 输了好几次。
    你们老师看样子是个tg.
      

  2.   

    var
      i:integer;
      str,str1:string;
      MyStringList:TStringList;
    begin
      MyStringList:=TStringList.create;
      str:='0102030405'
      for i:=0 to length(str) do
      begin
        MyStringList.add(Copy(str,i*2+1,2)+'  ');
      end;
      for i:=0 to MyStringList.count do
      begin
        str1:=str1+MyStringList.Strings[i];
      end;
      MyStringList.free;
    end;
    //str1就是你要求的两个号码后面有空格,随手写写,没测试过
      

  3.   

    老大,用这种方式来保存彩票号是不科学的。
    给你一个保存福利彩票号的表结构罢。create table cph(
    qs int not null,  //期数
    hm int not null   //号码
    primary key (qs,hm)
    )同一期的号码中不可能有两个号码相同(对一般福彩而言)。
    对于双色球而言,每期有个号码是16选1的,它可能与前面的号码相同。所以需要再建一个表。
    对于体彩类的号码,可以这样保存:create table cph1(
    qs int not null,  //期数
    ws int not null,   //号码所在位置
    value int not null //本位置的号码(可取0-9之间任一个)
    primary key (qs,hm)
    )这样查起来才方便嘛。
      

  4.   

    不好意思
    错了for i:=0 to length(str) do应该改成
    for i:=0 to length(str) div 2 -1 dofor i:=0 to MyStringList.count do改成for i:=0 to MyStringList.count-1 do
      

  5.   

    for i:=0 to length(str) do
    case ord(str[i]) of
    65:...
    66:...
    end;
      

  6.   

    你在Combobox1的ComboBox1Change事件中写上:
    showmessage(combobox1.Items.Strings[combobox1.ItemIndex]);