设有如下程序: Private Sub Inv(ByVal xStr As String, yStr As String) Dim tStr As String Dim L As Integer L = Len(xStr)

admin2015-08-28  38

问题 设有如下程序:
Private Sub Inv(ByVal xStr As String, yStr As String)
    Dim tStr As String
    Dim L As Integer
    L = Len(xStr)
    Do While L >= 1
        tStr = tStr + Mid(xStr, L, 1)
        L = L - 1
    Loop
    yStr = tStr
End Sub
Private Sub Form_Click()
    Dim S1 As String, S2 As String
    S1 = "abcdef"
    Inv S1, S2
    Print S2
End Sub
运行程序,单击窗体,输出结果为

选项 A、abcdef
B、afbecd
C、fedcba
D、defabc

答案C

解析 Mid函数将返回字符串中从L开始的一个字符,L从字符串长度反向递减。因此Inv函数实现字符串翻转功能。选C)。
转载请注明原文地址:https://kaotiyun.com/show/e6Lp777K
0

最新回复(0)