更多"如果存在如下过程: Private Function Fun( "的相关试题:
[填空题]如果存在如下过程:
Private Function Fun(a( ) As Integer)
Dim First As Integer, Last As Integer,i As Integer
First=LBound(a)
Last=UBound(a)
Max=a(First)
For i=First To Last
If a(i)> Max Then Max=a(i)
Next
Fun=Max
End Function
在窗体上添加一个命令按钮,然后编写如下事件过程:
Private Sub Command1_Click( )
ReDim m(1 To 4)As Integer
m(1)=20: m(2)=30: m(3)=50: m(4)=100
c=Fun(m)
Print C
End Sub
单击命令按钮,其输出结果为 (9) 。
[填空题]如果存在如下过程:
Private Function FMaxla( ) As Integer)
Dim First As Integer,Last As Integer,i As Integer
First=LBound(a)
Last=UBound(a)
Max=a(First)
For i=First To Last
If a(i)>Max Then Max=a(i)
Next i
FMax=Max
End Function
在窗体上添加一个命令按钮,然后编写如下事件过程:
Private Sub Command_Click( )
ReDim m(1 To 4)As Integer
m(1)=20:m(2)=30:m(3)=50:m(4)=100
C=FMax(m)
Print C
End Sub
单击命令按钮,其输出结果为 (8) 。
[填空题]如果存在如下过程:
Private Function FMax(a( )As Integer)
Dim First As Integer,Last As Integer,i As Integer
First=LBound(a)
Last=UBound(a)
Max=a(First)
Fori=FirSt To Last
Ifa(i)>Max ThenMax=a(i)
Nexti
FMax=Max
End Function
在窗体上添加一个命令按钮,然后编写如下事件过程:
Ptirate Sub Commandl_click( )
ReDimm(1 To4)As Integer
m(1)=20:m(2)=30:m(3)=50:m(4)=100
C=FMax(m)
Print C
End Sub
单击命令按钮,其输出结果为______。
[单项选择]设有以下函数过程
Private Function Fun(a( )As Integer,b As String) As Integer
End Function
若已有变量声明:
Dim x(8)As Integer,n As Integer,m As String
则下面正确的过程调用语句是______。
A. x(0)=Fun(x,"m")B) n=Fun(n,m)
B. Call Fun x, "m"D) n=Fun(x(8) ,m)
[填空题]如果存在如下过程:
Private Function FMax( a( ) As Integer)
Dim First As Integer, Last As Integer, i As Integer
First = LBound(a)
Last = UBound(a)
Max = a(First)
For i = First To Last
If a (i)>Max Then Max=a (i)
Next
FMax = Max
End Function
Private Sub Commandl Click( )
ReDim m (1 To 4) As Integer
re(1) =20: m(2) =30: m(3) =50: m(4) =100
c = FMax(m)
Print c
End Sub
单击命令按钮,其输出结果为 【13】 。
[单项选择]某人为计算n!(0<n≤12)编写了下面的函数过程:
Private Function Fun(n As Integer) As Long
Dim p As Long
p=1
For k=n-1 To 2 Step-1
p=p*k
Next k
fun=p
End Function
在调试时发现该函数过程产生的结果是错误的,程序需要修改。下列的修改方案中有三种是正确的,错误的方案是
A. 把p=1改为p=n
B. 把For k=n-1 To 2 Step-1改为For k=1 To n-1
C. 把For k=n-1 To 2 Step-1改为For k=1 to n
D. 把For k=n-1 To 2 Step-1改为For 2 To n
[单项选择]某人为计算n!(0<n<=12)编写了下面的函数过程:
Private Function fun(n As Integer)As Long
Dim P As Long
P=1
For k=n-1 To 2 Step-1
p=p*k
Next k
fun=p
End Function
在调试时发现该函数过程产生的结果是错误的,程序需要修改。下面的修改方案中有3种是正确的,错误的方案是( )
A. 把p=1改为p=11
B. 把For k=n-1 To 2 Step-1改为For k=1 To n-1
C. 把For k=n-1 T0 2 Step-1改为For k=1 To n
D. 把For k=-n-1 To 2 Step-1改为For k=2 To n
[单项选择]有如下函数:Private Function firstfunc(x As Integer, y As Integer) As Integer Dim n As Integer Do While n <= 4 x=x +y n=-+1 Loop firstfunc = x End Function调用该函数的事件过程如下:Private Sub Command1_lick( ) Dim x As Integer Dim y As Integer Dim n As Integer Dim z As Integer x=1 y=1 For n = 1 To 3 z = firstfunc(x, y) Next n Print z End Sub该事件过程的执行结果是 ______。
A. 1
B. 3
C. 16
D. 9
[单项选择]
某人为计算n!(0<n<=12)编写了下面的函数过程:
Private Function fun(n As Integer)As Long
Dim P As Long
p=1
For k=n-1 To 2 Step-1
p=p*k
Next k
fun=P
End Function
在调试时发现该函数过程产生的结果是错误的,程序需要修改。下面的修改方案中有3种是正确的,错误的方案是()。
A. 把P=1改为P=n
B. 把For k=n-1 To 2 Step-1改为For k=1 To n-1
C. 把For k=n-1 To 2 Step-1改为For k=1 To n
D. 把For k=n-1 To 2 Step-1改为For k=2 To n
[单项选择]有如下函数过程:
Function Fun(ByVal x As Integer,ByVal y As Integer)As Integer
Do While y<>0
reminder=x Mod y
x=y
y=reminder
Loop
Fun=x
End Function
以下调用函数的事件过程,该程序的运行结果是( )。
Private Sub Command7_Click( )
Dim a As Integer,b As Integer
a=100:b=25
x=Fun(a,B)
Print X
End Sub
A. 0
B. 25
C. 50
D. 100