vb6.0中如何把十进制整数转换为二进制整数,一及二进制整数到十进制的转换
2个回答
2015-11-17
展开全部
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
2015-11-17
展开全部
你是要编程吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询