首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
编写如下程序: Private Sub Command1_Click() Dim str1 As String, str2 As String str1=InputBox("输入一个字符串") subf str1, str2 Print s
编写如下程序: Private Sub Command1_Click() Dim str1 As String, str2 As String str1=InputBox("输入一个字符串") subf str1, str2 Print s
admin
2018-12-20
56
问题
编写如下程序:
Private Sub Command1_Click()
Dim str1 As String, str2 As String
str1=InputBox("输入一个字符串")
subf str1, str2
Print str2
End Sub
Sub subf(s1 As String, s2 As String)
Dim temp As String
Static i As Integer
i=i+1
temp=Mid(s1, i, 1)
If temp<>"" Then subf s1, s2
s2=s2 & temp
End Sub
程序运行后,单击命令按钮Command1,且输入"abcdef",则输出结果为( )。
选项
A、afbecd
B、cdbeaf
C、fedcba
D、adbecf
答案
C
解析
程序中过程subf的两个参数都默认按址传递,其内部定义的变量i为Static即静态变量,在过程调用时它会保留上次的值。这个过程的功能是通过递归调用自己依次取出参数1中即s1中的字符连接在s2的尾部,即使s1的字符串倒序后存入s2中。程序中输入了abcdef,则输出结果为fecdba。
转载请注明原文地址:https://kaotiyun.com/show/XjFp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
命令按钮Command1的事件过程如下:PrivateSubCommand1_Click() Dimarr(5,5)AsInteger DimiAsInteger,jAsInteger Fori=1To4
在窗体上画一个名称为Command1的命令按钮,并编写如下程序:PrivateTypeRecord IDAsInteger NameAsString*20EndTypePrivateSubCommand1_Click()
VisualBasic源程序的续行符为
以下关于多重窗体程序的叙述中,错误的是( )。
标准模块中有如下程序代码:PublicxAsInteger,yAsIntegerSubvar_pub() x=10∶y=20EndSub在窗体上有1个命令按钮,并有如下事件过程:PrivateSubCommand1_Clic
对于某些控件,只要将其Style属性设置为1,则可以在该控件上使用Picture属性显示图片。以下不具备这一使用规则的控件是
A、选择B、差C、交D、并B关系T是关系R的一部分,并且是关系R去掉R和S相同的元素,符合差操作。
以下表达式与Int(3.5)的值相同的是
一般情况下,当对关系R和S进行自然连接时,要求R和S含有一个或者多个共有的
随机试题
我国《法制日报》对法律所作的解释是_____________。
简述王明“左”倾教条主义的主要错误及其危害。
纤溶酶的主要作用是
下列药,擅治阳明经头痛的是
依据法律规定,债务人未向第三人履行债务或者履行债务不符合约定,应()。
—Emma,thanksfor______meyourpen.—You’rewelcome.
Accordingtoarecentsurvey,teachersarenotanymoreconsideredasgoodexamplesforstudents.Thelatterconsiderthattheb
“着色”的“着"应读作()。
Hurricanesareviolentstormsthatcausemillionsofdollarsinpropertydamageandtakemanylives.Theycanbeextremelydange
NowintheU.S.thewomenworkingoutsidehomecanget______.Theexpression"full-timehousework"inparagraph2means______
最新回复
(
0
)