填空题 执行下列程序,在文本框Text1中输入数据”as235gh458yj”后,单击Command1按钮,在列表框List1中共有 1个列表项,列表框List1的第一行是 2,列表框List1的第二行是 3,列表框List2的最后一行是 4
Option Explicit
Private Sub Command1_Click()
Dim st As String, s As String
Dim p As String, cnt() As Integer, i As Integer, n As Integer
s=Text1.Text
For i=1 To Len(s)
st=Mid(s, i, 1)
If st>="a" And st<="z" Then
p=p&st
Else
If p<>"" Then List1.AddItem p
p=""
End If
Next
If p<>"" Then List1.AddItem p
ReDim cnt(List1.ListCount)
For i=1 To UBound(cnt)
p=List1.List(i-1)
cnt(i)=Val(Left(p, Len(p)-1))
n=Val(Right(p, 1))
List2.AddItem fun(cnt(i), n)
Next
End Sub
Private Function fun(x As Integer, y As Integer)As Integer
Dim p As Integer, k As Integer
Do
p=x Mod 10
fun=fun+p*y^k
x=x/10
k=k+1
Loop Until x<=10
End Function
【正确答案】
【答案解析】2 235 458 5