题型:综合题 题类:常考题 难易度:困难
浙江省嘉兴五中2019-2020学年高二下学期信息技术期中测试卷
Private Function bw(x As Integer, y As String) As String
'函数bw功能:若二进制位数不足,通过在前面添"0"使得位数为4的倍数
Dim r As Integer, i As Integer
r = x Mod 4
If r <> 0 Then
For i = 1 To 4 - r
y = "0" + y
Next i
x = Len(y)
End If
bw=
End Function
Private Sub Command1_Click()
Dim m As String, n As Integer, i As Integer, a As Integer
Dim s As Integer, s1 As String, j As Integer
m = Text1.Text
n = Len(m)
Text2.Text = ""
m = ’调整 m 的位数为 4 的倍数
For i = 1 To n - 3 Step 4
s = 0
For j = i To i + 3
a = Val(Mid(m, j, 1))
s =
Next j
If s >= 10 Then
s1 = Chr(Asc("A") + s - 10)
Else
s1 = CStr(s) '函数 CStr 类似于 Str,但无前导空格
End If
Text2.Text = Text2.Text + s1
Next i
End Sub
试题篮