……
begin
    for j := 0 to 7 do
    begin
      if j <> 0 then
      begin
        h := (Value shr j)and 1;
        result := inttostr(h) + '_' + result ;
      end
      else
      begin
        h := (Value shr j)and 1;
        result := inttostr(h);
      end;
    end;
  end;
…… h,j都是integer;Value是Variant型的;result是string型的

解决方案 »

  1.   

    將一個 integer 轉為 2進制的表示如
    0_0_1_1...
      

  2.   

    h := (Value shr j)and 1;怎么理解?
      

  3.   

    (Value shr j)and 1
      好象是 Value 的值像右移j位补1的意思
      

  4.   

    帮助上是这样的~~~~
    if N stores the value 01101 (decimal 13), then N shl 1 returns 11010 (decimal 26)shl 向左
    shr 向右
      

  5.   

    h := (Value shr j)and 1;
    这段代码是什么意思呢?最好是把所有的代码复制完好吗?可能里面有些变量,我不清楚的,最好写完全好吗?