执行下面的程序,单击command1,窗体上显示的第一行是(),第二行是(),第四行是(),最后一行是()
Option Explicit
Private Sub Command1_Click( )
Dim n As Integer
n=5
Call test(n)
Print n
End Sub
Private Sub test(ByVal n As Integer)
Dim i As Integer,S As String
If n>0 Then
For i=l To n
S=S & CStr(i)
Next i
Print S
Call test(n-2)
Else
Print "0VER"
EndIf
EndSub
执行下面程序,单击命令按钮Command1,窗体上显示的第一行内容是(),第二行内容是(),第三行内容是().
Option Explicit
Private Sub Command1_Click( )
Dim a As Integer, b As Integer, i As Integer
a = 1
b = 5
For i = b To a Step -1
a = a + i
b = b + a
If b > 30 Then Exit For
Print a, b
Next i
Print a, b
End Sub
执行下面程序,单击Commandl,则图片框中显示的第一行是(),显示的第二行是() ,最后一行显示的是 () 。
Private Sub Command1_Click( )
Dim a(3,3)As Integer
Dim i As Integer,j As Integer
For i=1 To 3
For j=3 To 1 Step -1
If i>=j Then
a(i,j)=i-j
Else
a(i,j)=j-i
End If
Next j
Next i
For i=1 to 3
For j=3 To 1 Step -1
Picture1.Print a(i,j);
Next j
Picturel.Print
Next i
EndSub
执行下面程序,单击命令按钮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
执行下面程序,单击命令按钮CmdRun后,图片框Pic1第一行显示内容是(),第二行显示内容是(),最后一行显示内容是()。
Option Explicit
Private Sub CmdRun_Click( )
Dim N As Integer,M As Integer
M=135
N=8
Pic1.Print Fun(M,N)
EndSub
Private Function Fun(ByVal N As Integer,ByVal R As Integer)As String
Dim L As Integer
If N
Fun=N
Else
L=N/R
Fun=Fun(L,R)
Fun=Fun & N Mod R
End If
Pic1.Print N
End Function
执行下面程序,单击命令按钮Cmd1后,窗体上显示的第一行内容是(),第二行内容是(),第三行内容是()。
Option Explicit
Private Sub Cmd1_Click( )
Dim st As String,ch As String*1,t As Integer
Dim i As Integer
st="2,3,8,12,32,65#"
For i=1 To Len(st)
ch=Mid(st,i,1)
If ch<>"," And ch<>"#" Then
t=t*10+Val(ch)
Else
If pd(t) Then Print t
t=0
End If
Next i
End Sub
Private Function pd(ByVal n As Integer)As Boolean
Do While n<>1
If n Mod 2<>0 Then
Exit Function
EndIf
n=n/2
Loop
pd=True
End Function
执行下面程序,单击按钮CmdRun,窗体上显示的第一行结果是(),UBound(a)的值为(),其中a(1)的值为().
Option Explicit
Private Sub CmdRun_Click( )
Dim St As String,i As Integer
Dim a( ) As String,j As Integer,k As Integer
St="abcd"
Call Sub1(St)
Print St
For i=1 To Len(St)
For j=i+1 To Len(St)
If Mid(St,i,1)=Mid(St,j,1) Then Exit For
Next j
If j>Len(St) Then
k=k+1
ReDim Preserve a(k)
a(k)=Mid(St,i,1)
Print "a(";k;")=";a(k)
End If
Next i
End Sub
Private Sub Sub1(S As String)
Dim i As Integer
For i=1 To Len(S)/2
Mid(S,i,1)=Mid(S,Len(S)-i+1,1)
Next i
End Sub
我来回答: