有下面程序代码: Private Sub Command1 Click() Dim a As String a=“COMPUTER”n=so~eh(a,“T”):Print Utln=0,“未找到”,n) End Sub Private Function

admin2018-10-18  18

问题 有下面程序代码:
Private Sub Command1 Click()
Dim a As String
a=“COMPUTER”n=so~eh(a,“T”):Print Utln=0,“未找到”,n)
End Sub
Private Function seareh(strAs String,ehAs String)As Integer
For k=l T0 Len(str)
c=Mid(str,k,1.)
Ife=eh Then
search=k:Exit Ftmction
End If
Nextk

选项 A、0
B、8
C、6
D、未找到

答案C

解析 本题中search函数的参数是两个字符串,在函数内进行循环,依次取出第一个参数的第k位和第二个参数进行比较,如果相等则返回k的值,实际上就是查找第二个参数在第一个参数中出现的位置。
转载请注明原文地址:https://kaotiyun.com/show/OHFp777K
0

最新回复(0)