Private Sub Command1_Click()
Print Dec_to_Bin(3)
Print Bin_to_Dec("10")
End Sub
Public Function Dec_to_Bin(ByVal Dec As Long) As String '十进制to二进制
Dec_to_Bin = ""
Do While Dec > 0
Dec_to_Bin = Dec Mod 2 & Dec_to_Bin
Dec = Dec \ 2
Loop
End Function
Public Function Bin_to_Dec(ByVal Bin As String) As Long '二进制to十进制
Dim i As Long
For i = 1 To Len(Bin)
Bin_to_Dec = Bin_to_Dec * 2 + Val(Mid$(Bin, i, 1))
Next
End Function
你是要编程吗?