更多"如下事件过程:
Function Feed(x)
If"的相关试题:
[单项选择]如下事件过程:
Function Feed(x)
If x <10 Then
Feed=X
Else
Feed=10+x
End If
End Function
Private Sub Command1_Click( )
x=Val(Input Box(" ",0))
pay=Feed(x)
Print pay
End Sub
运行时在输入框内输入变量x的值为15,输出结果为( )。
A. 0
B. 15
C. 25
D. 30
[单项选择]有如下事件过程:
Function UNC (ByVal x As Integer,ByVal y As Integer) As Integer
Do While y<>0
sic=x/y
x=y
y=sic
Loop
UNC=x
End Function
以下是该函数的调用过程,该程序的运行结果是( )。
PriVate Sub COmmand1_Click( )
Dim a As Integer
Dim b As Integer
a=12
b=2
x=UNC (a,b)
Print x
End Sub
A. 0
B. 6
C. 2
D. 80
[单项选择]有如下事件过程: Function UNC (ByVal x As Integer,ByVal y As Integer) As Integer Do While y<>0 sic=x/y x=y y=sic Loop UNC=x End Function 以下是该函数的调用过程,该程序的运行结果是 PriVate Sub COmmand1_Click( ) Dim a As Integer Dim b As Integer a=12 b=2 x=UNC (a,b) Print x End Sub
A. 0
B. 6
C. 2
D. 80
[填空题]在窗体上有一个命令按钮,然后编如下事件过程:
Function SR( x As Double)As Double
Select Case Sgn(x)
Case 1
SR=Sqr(x)
Exit Function
Case 0
SR=0
Case-1
SR=-1
End Select
End Function
Private Sub Command1 _ Click( )
Dim Msg,SRN
Dim N AS Double
N=InputBox("请输入要计算平方根的数")
Msg=N&"的平方根"
Select Case SR(N)
Case 0
Msg=Msg &"是0"
Case-1
Msg=Msg&"是一个虚数"
Case ElSe
Msg=Msg &"是"& SR(N)
End Select
MsgBox Msg
End Sub
程序运行后,单击命令按钮,在输入对话框内输入-1,输出结果是【 】。
[单项选择]编写如下事件过程和函数过程:
Private Sub Command1_Click( )
Dim num(1 To 6) As Single
num(1)=103: num(2)=190: num(3)=0
hum(4)=32:num(5)=-56: num(6)=100
Print
Print p2(6,num( ))
End Sub
Private Function p2(ByVal n As Integer, number( ) As Single) As Integer
p2=number(1)
For j=2 To n
If number(j)<p2 Then p2=number(j)
Next j
End Function
程序运行后,在窗体上输出( )。
A. -56
B. 0
C. 103
D. 190
[填空题]设有如下窗体单击事件过程:
Private Sub Form _Click( )
x=1
For i=1 To 3
Select Case i
Case 1, 3
x=x+3
Case 2, 4
x=x-2
End Select
Next i
MsgBox x
End Sub
打开窗体运行后,单击窗体,则消息框的输出的结果是 (13) 。
[单项选择]编写如下事件过程和函数过程:
Private Sub Form_Chck( )
DimBum(1 To 6)As Single
num(1)=103:num(2)=190:num(3)=0
Bum(4)=32:num(5)=-56:num(6)=100
Print
Pdnt p2(6,hum( ))
End Sub
Private Function p2(ByVal n As Integer,number( )As Single)As Integer
p2=number(1)
Forj=2 Ton
lfnumber(j)<p2 Thenp2=number(j)
Next j
End Function
程序运行后窗体上显示的值是( )。
A. -56
B. 0
C. 103
D. 190
[单项选择]编写如下事件过程:
Option Explicit
Private Sub Form_Click( )
Dim Str As String, I As Integer
Open "examp" For Output As 1
For I=1 To 5
Str=Chr(I+64)
Print #1,Str;
Next I
Close 1
Open”examp’,For lnput AS 2
Str=Input(10,#2)
Print Str;
Close 2
End Sub
程序运行后,单击窗体,则窗体上显示的内容是
A. ABCDE
B. 96
C. 65
D. abcde