求错 vb程序二进制转换为十进制
答案:5 悬赏:40 手机版
解决时间 2021-02-25 17:09
- 提问者网友:一抹荒凉废墟
- 2021-02-25 14:11
Text)
For i = 1 To Len(x)
y = y + Val(Right(x, y As Long, i As Integer
x = Str(Text1Private Sub Command1_Click()
Dim x As Integer, i)) * 2 ^ (i - 1)
Next i
Text2
如何改正
最佳答案
- 五星知识达人网友:千杯敬自由
- 2021-02-25 15:32
Private Sub Command1_Click()
Dim x As String, y As Long, i As Integer
x = trim(Text1.Text)
For i = 1 To Len(x)
y = y + Val(Mid(x, Len(x) - i + 1, 1)) * 2 ^ (i - 1)
Next i
Text2.Text = y
End Sub
Dim x As String, y As Long, i As Integer
x = trim(Text1.Text)
For i = 1 To Len(x)
y = y + Val(Mid(x, Len(x) - i + 1, 1)) * 2 ^ (i - 1)
Next i
Text2.Text = y
End Sub
全部回答
- 1楼网友:英雄的欲望
- 2021-02-25 17:56
y = y + Val(Right(x, i)) * 2 ^ (i - 1)改为 y = y + mid((x, i,1)) * 2 ^ (i - 1)
- 2楼网友:笑迎怀羞
- 2021-02-25 17:31
n = val(text1.text)
do
k = n mod 2
n = n \ 2
nk =str$(k)+nk
while n<>0
do
k = n mod 2
n = n \ 2
nk =str$(k)+nk
while n<>0
- 3楼网友:胯下狙击手
- 2021-02-25 17:11
Private Sub Command1_Click()
Dim x As string, y As Long, i As Integer
x = Text1.Text
For i = 1 To Len(x)
y = y + Val(mid(x, i,1)) * 2 ^(len(x)-i)
Next i
Text2.Text = y
End Sub
这样是伐?
我试了一下,不是可以么?
- 4楼网友:英雄的欲望
- 2021-02-25 16:38
i, 1))) = 1 Then
y = y + (Val(Mid(Text1.Text = ""
Text2.Text, i.Text).Text)
For i = 1 To Len(x)
If (Val(Mid((Text1, i As Integer
x = Str(Text1.Text), 1))) * (2 ^ (Len(x) - (i + 1)))
Else
Text1Private Sub Command1_Click()
Dim x As String, y As Long, i, 1))) = 0 Or (Val(Mid((Text1
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯