[填空题] 执行下面程序,单击命令按钮cmd1后,窗体上显示的第一行内容是___(13)___,第二行内容是___(14)___ ;最后一行内容是___(15)___ Option Explicit
[填空题] 执行下面程序,单击命令按钮cmd1后,窗体上显示的第一行内容是___(13)___,第二行内容是___(14)___ ;最后一行内容是___(15)___ Option Explicit Private Sub Cmdl_Click()Dim i As Integer,c As Integer,s As String,t As String*1Dim a() As String,s1 As String,jg As Integers="43X17Z23Y"’For i=1 To Len(s) t=Mid(s,i,1) s1=s1 & t If t>="X" And t<="Z" Then c=c+1 ReDim Preserve a(c) a(c)=s1 s1="" End IfNext iCall sub1(a,jg)Print jg EndSub Private Sub sub1(a() As String,gj As Integer)Dim i As IntegerFor i=1 To UBound(a) gj=gj+tran(a(i))Next igj=gj/UBound(a) End Sub Private Function tran(ss As String)As IntegerDim i As Integer,t As Integer,st As String*1Dim P As IntegerP=Len(ss)-1st=Right(ss,1)If st="X" Then t=8ElseIf st="Y" Then t=10Else t=16End IfFor i=1 To P tran=tran+Val(Mid(ss,i,1))*t^(P-i)Next iPrint tran End Function
参考答案: