十进制数怎么换算成二进制数、在线等

问题描述:

十进制数怎么换算成二进制数、在线等
十进制数怎么换算成二进制数 求方法
如将二进制数1011换算成十进制数应为:1×2^3+0×2^2+1×2^1+1×2^0

Sub bb()
On Error GoTo 10:
n = 1237
s = Hex(n)
l = "0000000100100011010001010110011110001001101010111100110111101111"
e = ""
e = e & Mid(l,CLng("&H" & Mid(s,1,1)) * 4 + 1,4)
e = e & Mid(l,CLng("&H" & Mid(s,2,1)) * 4 + 1,4)
e = e & Mid(l,CLng("&H" & Mid(s,3,1)) * 4 + 1,4)
e = e & Mid(l,CLng("&H" & Mid(s,4,1)) * 4 + 1,4)
e = e & Mid(l,CLng("&H" & Mid(s,5,1)) * 4 + 1,4)
e = e & Mid(l,CLng("&H" & Mid(s,6,1)) * 4 + 1,4)
e = e & Mid(l,CLng("&H" & Mid(s,7,1)) * 4 + 1,4)
10:
MsgBox "二进制为" & e
End Sub