问题 填空题

执行下面程序,单击命令按钮CmdRun后,文本框Text1中第一行显示的内容是() , 第二行显示的内容是()。第三行显示的内容是()。

Option Explicit

Private Sub CmdRun_Click()

Dim S As String,Subs As String,P As Integer

S="100101 010110 110101"

Do

P=InStr(S," ")

If P<>0 Then

Subs=Left(S,P-1)

Else

Subs=S

End If

S=Mid(S,P+1)

Text1=Text1 & Complement(Subs) & vbCrLf

Loop Until Len(S)=0 Or P=0

End Sub

Private Function Complement(S As String)As Integer

Dim P As Integer,L As Integer

L=Len(S)

If Left(S,1)=1 Then

Complement=-32

End If

P=1

Do Until P=0

P=InStr(P+1,S,"1")

If P<>0 Then

Complement=Complement+2^(L-P)

End If

Loop

End Function

答案

参考答案:-27;22;-11

单项选择题 B型题
单项选择题