vb题目 下面程序,单击Comamd1 按钮,Text1中输入“12123152”,则窗体显示的第二行为什么是:123
下面程序,单击Comamd1按钮,Text1中输入“12123152”,则窗体显示的第二行为什么是123OptionExplicitOptionBase1PrivateS...
下面程序,单击Comamd1 按钮,Text1中输入“12123152”,则窗体显示的第二行为什么是 123
Option Explicit
Option Base 1
Private Sub Command1_Click()
Dim s As String, i As Integer, a() As Integer
s = Text1.Text
For i = 1 To Len(s)
ReDim Preserve a(i)
a(i) = Val(Mid(s, i, 1))
Next i
Call Sub1(a)
End Sub
Private Sub Sub1(a() As Integer)
Dim i As Integer, j As Integer, k As Integer
i = 2
Do Until i >= UBound(a)
k = i - 1
Do Until a(i - 1) > a(i)
i = i + 1
Loop
For j = k To i - 1
Print a(j)
Next j
Print
i = i + 1
Loop
End Sub 展开
Option Explicit
Option Base 1
Private Sub Command1_Click()
Dim s As String, i As Integer, a() As Integer
s = Text1.Text
For i = 1 To Len(s)
ReDim Preserve a(i)
a(i) = Val(Mid(s, i, 1))
Next i
Call Sub1(a)
End Sub
Private Sub Sub1(a() As Integer)
Dim i As Integer, j As Integer, k As Integer
i = 2
Do Until i >= UBound(a)
k = i - 1
Do Until a(i - 1) > a(i)
i = i + 1
Loop
For j = k To i - 1
Print a(j)
Next j
i = i + 1
Loop
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询