vb中把十进制转换为二进制的程序怎么写 急求 T_T
答案:2 悬赏:30 手机版
解决时间 2021-03-26 04:56
- 提问者网友:难遇难求
- 2021-03-25 14:53
vb中把十进制转换为二进制的程序怎么写 急求 T_T
最佳答案
- 五星知识达人网友:刀戟声无边
- 2021-03-25 15:48
Private Sub Command1_Click()
Dim n As Long
n = Val(Text1.Text)
Text2.Text = ""
Do While n > 0
Text2.Text = (n Mod 2) & Text2.Text
n = n 2
Loop
End Sub
Dim n As Long
n = Val(Text1.Text)
Text2.Text = ""
Do While n > 0
Text2.Text = (n Mod 2) & Text2.Text
n = n 2
Loop
End Sub
全部回答
- 1楼网友:底特律间谍
- 2021-03-25 16:39
Option Explicit
Dim sBin As String
Dim sHex As String
Private Sub Command1_Click()
sHex = Hex(Val(Text1))
Text2 = sHex
HexToBin (sHex)
Text3 = sBin
sBin = ""
End Sub
Private Sub Form_Load()
Text1 = ""
End Sub
Public Function HexToBin(ByVal sHex As String) As String '处理16进制转换2进制代码
Const s1 = "000010100110
Dim sBin As String
Dim sHex As String
Private Sub Command1_Click()
sHex = Hex(Val(Text1))
Text2 = sHex
HexToBin (sHex)
Text3 = sBin
sBin = ""
End Sub
Private Sub Form_Load()
Text1 = ""
End Sub
Public Function HexToBin(ByVal sHex As String) As String '处理16进制转换2进制代码
Const s1 = "000010100110
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯