在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:Dim SW As BooleanFunction func(X As Integer) As IntegerIf X<20 ThenY=XElseY=20+XEnd Iffunc=YEnd FunctionPrivate Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)SW=FalseEnd SubPdvate Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)SW=TrueEnd SubPrivate Sub Command1_Click()Dim intNum As IntegerintNum=InputBox("")If SW ThenPrint func(intNum)End IfEnd Sub程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为A.输出0B.输出25C.输出45D.无任何输出
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:
Dim SW As Boolean
Function func(X As Integer) As Integer
If X<20 Then
Y=X
Else
Y=20+X
End If
func=Y
End Function
Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
SW=False
End Sub
Pdvate Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)
SW=True
End Sub
Private Sub Command1_Click()
Dim intNum As Integer
intNum=InputBox("")
If SW Then
Print func(intNum)
End If
End Sub
程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为
A.输出0
B.输出25
C.输出45
D.无任何输出
相关考题:
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() a S="VisualBasic" Print String(3, a$) End Sub 程序运行后,单击命令按钮,在窗体上显示的内容是______。A.VVVB.VisC.sicD.11
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Private Sub Command1_Click() Dim x As Integer Static y As Integer Cls x=x+5 y=y+3 Print x,y End Sub 程序运行时,两次单击命令按钮Command1后,窗体显示的结果是( )。A.10 6B.5 6C.5 3D.10 3
在窗体上画一个命令按钮,然后编写如下程序:Dim x As IntegerSub inc(a As Integer)x=x+aEnd SubPrivate Sub Command1_Click()inc 2inc 3inc 4Msgbox x;End Sub程序执行后,单击Command1命令按钮,消息框显示结果是【 】。
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:Private Sub Commandl_Click( )Static X As IntegerStatic Y As IntegerClsY=1Y=Y+5X=5+XPrint X, YEnd Sub程序运行时,3次单击命令按钮Command1后,窗体上显示的结果为【 】。
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:Private Sub Command1_ Click() Static x As Integer Static y As Integer Cls y=1 y=y+5 x=y +x Print x, yEnd Sub程序运行时,三次单击命令按钮Command1后,窗体上显示的结果为______。A.15 16B.15 6C.15 15D.5 6
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Privme Sub Command1_Click( ) a$="VisualBasic" Print String(3,a$) End Sub 程序运行后,单击命令按钮,在窗体上显示的内容是A.VVVB.VisC.sicD.11
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:Private Sub Command1_Click()x = -5If Sgn(x) Then y = Sgn(x ^ 2)Else y = Sgn(x)End IfPrint yEnd Sub程序运行后,单击命令按钮,窗体上显示的是( )。A.-5B.25C.1D.-1