• 2021-04-14 问题

    下列myDecimal函数的功能是字符串s表示的r进制数转变成十进制数。如s=“3a” , r=16,则结果是58。请在_________处填入适当的内容完善程序。 Function myDecimal(ByVal s$, ByVal r%) As Integer Dim i%, c$, n% For i = 1 To Len(s) c = Mid(s, i, 1) Select Case c Case "a" To "z" n = Asc(c) - Asc("a") + 10 Case "A" To "Z" n = Asc(c) - Asc("A") + 10 Case Else n = Val(c) End Select myDecimal = _________ Next End Function

    下列myDecimal函数的功能是字符串s表示的r进制数转变成十进制数。如s=“3a” , r=16,则结果是58。请在_________处填入适当的内容完善程序。 Function myDecimal(ByVal s$, ByVal r%) As Integer Dim i%, c$, n% For i = 1 To Len(s) c = Mid(s, i, 1) Select Case c Case "a" To "z" n = Asc(c) - Asc("a") + 10 Case "A" To "Z" n = Asc(c) - Asc("A") + 10 Case Else n = Val(c) End Select myDecimal = _________ Next End Function

  • 1