程序参考,除了没有补足4位(这个自己改下,没有难度的),其它都是按要求实现了Private Sub Command1_Click()Dim a As Integer h = Text1.Text For i = 1 To Len(Text1.Text) c = Mid(h, i, 1) If Not ((c >= "0" And c <= "9") Or (c >= "a" And c <= "z")) Then MsgBox "输入错误,请重输" Command1.SetFocus Exit Sub End If Next a = Val("&h" + h)Dor = a Mod 2b = r & ba = a \ 2Loop While a > 0Label2.Caption = bEnd Sub