窗体上有1个名称为Command 1的命令按钮;1个名称为List 1、没有列表项的列表框。编写如下程序: Private Sub Command 1_Click() Dim XAs String,s As String,tempAs String

admin2015-05-29  18

问题 窗体上有1个名称为Command 1的命令按钮;1个名称为List 1、没有列表项的列表框。编写如下程序:
Private Sub Command 1_Click()
Dim XAs String,s As String,tempAs String
Dim i As Integer
X=InputBox("输入字符串","输入")
Ifx<>""Then
For i=Len(x)To 1 Step-1
S=Mid(x,i,1)
If S<>""Then
temp=s+temp
Else
List 1.Addltem temp
S=""
temp=""
End If
Next
List 1.Addltem temp
Else
MsgBox"输入内容为空!"
End If
程序运行后,单击命令按钮Command 1,并输入" Happy new year",则在List 1中显示的内容为

选项 A、year new Happy
B、Happy new year
C、raey wen yppaH
D、YPpaH wen raey

答案A

解析 本题的循环中倒序从字符串s中依次取出每一个字符,只要该字符不是空格就将其连接到temp的前面,见到空格就把连接好的temp加入到列表框中,即先加入year,然后是new,最后是Happy。
转载请注明原文地址:https://kaotiyun.com/show/YRQp777K
0

相关试题推荐
最新回复(0)