您的位置:首页 > 其它

十进制转化为十六进制

2016-05-07 17:39 465 查看
Private Sub Command1_Click()

   Dim a As Integer

   Dim b As Integer

   Dim yushu As Byte

   Dim s As String

   a = 1230

   b = 16

   While a <> 0

   a = a \ b

   yushu = a Mod b

   s = f(yushu) & s

   Wend

   Print s

End Sub

Private Function f(yushu As Byte) As String

If yushu <= 9 Then

f = yushu

Else

Select Case yushu

Case 10, 11, 12, 13, 14, 15

f = Chr(yushu + 55)

End Select

End If

End Function
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: