VB编程:用inputBOX输入一个字符串,以逆序形式输出。分别采用步长为正和负编程。
4个回答
展开全部
Private Sub Form_Click()
Dim t As String
Dim s As String
t = InputBox("输入")
For i = 1 To Len(t)
s = Mid(t, i, 1) & s
Next i
Print s
End Sub
Private Sub Form_Click()
Dim t As String
t = InputBox("输入")
For i = Len(t) To 1 Step -1
s = s & Mid(t, i, 1)
Next i
Print s
End Sub
Dim t As String
Dim s As String
t = InputBox("输入")
For i = 1 To Len(t)
s = Mid(t, i, 1) & s
Next i
Print s
End Sub
Private Sub Form_Click()
Dim t As String
t = InputBox("输入")
For i = Len(t) To 1 Step -1
s = s & Mid(t, i, 1)
Next i
Print s
End Sub
展开全部
VB6 有一个函数可以直接完成这个功能
Dim a As String, b As String
a = InputBox("请输入字符串")
b = StrReverse(a)
MsgBox b
Dim a As String, b As String
a = InputBox("请输入字符串")
b = StrReverse(a)
MsgBox b
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim a As String
a1 = 0
a2 = 0
a3 = 0
a = InputBox("请输入字符串,以?号结束")
For i = 1 To Len(a) - 1
c = Mid(a, i, 1)
Select Case Asc(c)
Case 65 To 90, 97 To 122
a1 = a1 + 1
Case 48 To 57
a2 = a2 + 1
Case Else
a3 = a3 + 1
End Select
Next i
Print Left(a, Len(a) - 1)
Print " 字母有" & a1 & "个"
Print " 数字有" & a2 & "个"
Print "其他字符有" & a3 & "个"
a1 = 0
a2 = 0
a3 = 0
a = InputBox("请输入字符串,以?号结束")
For i = 1 To Len(a) - 1
c = Mid(a, i, 1)
Select Case Asc(c)
Case 65 To 90, 97 To 122
a1 = a1 + 1
Case 48 To 57
a2 = a2 + 1
Case Else
a3 = a3 + 1
End Select
Next i
Print Left(a, Len(a) - 1)
Print " 字母有" & a1 & "个"
Print " 数字有" & a2 & "个"
Print "其他字符有" & a3 & "个"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
好
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询