设有如下函数定义:Function fun() As Integer Static a% fun = 3 * a + 1 a = a + 2End FunctionPrivate Sub Command1_Click() Dim n As Integer n = fun n = fun MsgBox (n)End Sub则在Command1_Click中 MsgBox 显示的结果是____________。
举一反三
- 中国大学MOOC: 设有如下程序代码:Private Function Fc(ByVal n As Integer) As Integer Fc = n * Fj(5)End FunctionPrivate Function Fj(ByVal n As Integer) As Integer Fj = n + 3End FunctionPrivate Sub Command1_Click() Dim a As Integer a = 3 Form1.Print Fc(a)End Sub程序时单击命令按钮,在窗体上输出的结果为( )。
- 如下程序的运行结果是【1】. Private Sub Command1_Click() Dim x As Integer x = 12 f2 x Print x End Sub Public Sub f2(n As Integer) n = n Mod 10 End Sub
- 某人设计了下面的函数fun,功能是返回参数a中数值的位数 Function fun(a As Integer) As Integer Dim n% n = 1 Do While a 10 > 0 n = n + 1 __________ Loop fun = n End Function 要使程序正确运行,在横线_____处应该填写的语句是.
- 某人设计了下面的函数fun,功能是返回参数a中数值的位数 Function fun(a As Integer) As Integer Dim n% n = 1 Do While a 10 >= 0 n = n + 1 a = a 10 Loop fun = n End Function 在调用该函数时发现返回的结果不正确,函数需要修改,下面的修改方案中正确的是
- 编写如下程序: Private Sub Command1_Click() Dim n As Integer : Static s As Integer For n = 1 To 3 s = s + n Next Print s End Sub 程序运行后,第三次单击命令按钮Command1时,输出结果为