b(i) = Mid(Text1.Text, Len(Text1.Text) - i, 1) 这里显示B(i)下标越界,为什么?怎么改?
PrivateSubCommand1_Click()Dimb$(),m%,i%,tagAsBooleanm=InputBox("将数组移动位置个数")Fori=0ToLe...
Private Sub Command1_Click()
Dim b$(), m%, i%, tag As Boolean
m = InputBox("将数组移动位置个数")
For i = 0 To Len(Text1.Text) - 1
b(i) = Mid(Text1.Text, Len(Text1.Text) - i, 1)
Next i
Call MoveStr(b(), m, tag)
tag = True
For i = Len(Text1.Text) - 1 To 0
Print b(i);
Next i
End Sub 展开
Dim b$(), m%, i%, tag As Boolean
m = InputBox("将数组移动位置个数")
For i = 0 To Len(Text1.Text) - 1
b(i) = Mid(Text1.Text, Len(Text1.Text) - i, 1)
Next i
Call MoveStr(b(), m, tag)
tag = True
For i = Len(Text1.Text) - 1 To 0
Print b(i);
Next i
End Sub 展开
展开全部
For i = 0 To Len(Text1.Text) - 1
b(i) = Mid(Text1.Text, Len(Text1.Text) - i, 1)
Next i
上面这三句改为
dim b
b=split(Text1.Text)
前面b$(), 去掉
b(i) = Mid(Text1.Text, Len(Text1.Text) - i, 1)
Next i
上面这三句改为
dim b
b=split(Text1.Text)
前面b$(), 去掉
追问
Public Sub MoveStr(a$(), m%, tag As Boolean)
Dim i%, j%
Dim c
If tag = True Then
For i = 1 To m
c = a(0)
For j = 0 To UBound(a) - 1
a(j) = a(j + 1)
Next j
a(UBound(a)) = c
Next i
Else
For i = 1 To m
c = a(UBound(a))
For j = UBound(a) To 1 Step -1
a(j) = a(j - 1)
Next j
a(0) = c
Next i
End If
End Sub
完成使数组向左移动m个位置,怎么改
追答
一问一贴,老规矩
展开全部
Private Sub Command1_Click()
Dim b$(), m%, i%, tag As Boolean
m = InputBox("将数组移动位置个数")
ReDim b(Len(Text1.Text) - 1) '加入这行。要先给b定义下标
For i = 0 To Len(Text1.Text) - 1
b(i) = Mid(Text1.Text, Len(Text1.Text) - i, 1)
Next i
Call MoveStr(b(), m, tag)
tag = True
For i = Len(Text1.Text) - 1 To 0
Print b(i);
Next i
End Sub
Dim b$(), m%, i%, tag As Boolean
m = InputBox("将数组移动位置个数")
ReDim b(Len(Text1.Text) - 1) '加入这行。要先给b定义下标
For i = 0 To Len(Text1.Text) - 1
b(i) = Mid(Text1.Text, Len(Text1.Text) - i, 1)
Next i
Call MoveStr(b(), m, tag)
tag = True
For i = Len(Text1.Text) - 1 To 0
Print b(i);
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询