题型:综合题 题类:常考题 难易度:普通
浙江省宁波市咸祥中学2019-2020学年高二下学期信息技术期中考试试卷
Private Sub Command1_Click()
Dim x As String, ch As String
Dim flag As Boolean, i As Integer, result As Long
x = ①
i = 1
result = 0
flag = True
ch = Mid(x, 1, 1)
Do While i <= Len(x) And flag = True
If ch >= "0" And ch <= "9" Then
result = result * 16 + Val(ch)
ElseIf ch >= "A" And ch <= "F" Then
result = result * 16 + (Asc(ch) - Asc("A") + 10)
ElseIf ch >= "a" And ch <= "f" Then
result = result * 16 + (Asc(ch) - Asc("a") + 10)
Else
flag = False
End If
i = i + 1
ch = ②
Loop
If flag = True Then
Label3.Caption = Str(result)
Else
Label3.Caption = "输入错误"
End If
End Sub
① ②
试题篮