REM ***********************************************
REM Title: Number Conversion
REM Author: Phaelax
REM Downloaded from: http://dbcc.zimnox.com/
REM ***********************************************
 
print "237      : ",hex$(237)
print "237      : ",bin$(237)
print "11101101 : ",binaryToDecimal("11101101")
print "0xed     : ",hexToDecimal(0xed)
 
 
suspend for key
end
 
function binaryToDecimal(b as string )
   value = 0
   length = len(b)-1
   for t = 0 to length
      if mid$(b,t+1) = "1" then inc value, 2^(length-t)
   next t
endfunction value
 
 
 
function hexToDecimal(h as integer )
   v = val(str$(h))
endfunction v