unit bill_foo;

interface

Type
  WrkString = String ( 255 );

function DecToBin ( DecInput : string ) : wrkstring;

implementation

function DecToBin ( DecInput : string ) : wrkstring;

{ converts a decimal string[ up to 256 ] into binary string }

var
   TempStr : wrkstring;
   DecNum  : integer;
   Mask    : word;
   Pos     : byte;

begin
  TempStr := '';
  mask    := 1 shl 5;
  ReadStr(DecInput,DecNum);
  for Pos := 1 to 6 do begin
    if (mask and DecNum) > 0 then
      TempStr := TempStr + '1'
    else TempStr := TempStr + '0';
      mask := mask div 2;
  end;
  (*$if 0 *)
    delete(TempStr,1,1);
  (*$endif *)
  DecToBin := TempStr;
end;

end.
