在窗体上画一个命令按钮(名称为Command1),并编写如下代码:Function Fun1(ByVal a As Integer, b As Integer) As Integer Dim t As Integer t = a – b b = t + a Fun1 = t + bEnd Function Private Sub Command1_Click() Dim x As Integer x = 10 Print Fun1(Fun1(x, (Fun1(x, x – 1))), x – 1)End
在窗体上画一个命令按钮(名称为Command1),并编写如下代码:Function Fun1(ByVal a As Integer, b As Integer) As Integer Dim t As Integer t = a – b b = t + a Fun1 = t + bEnd Function Private Sub Command1_Click() Dim x As Integer x = 10 Print Fun1(Fun1(x, (Fun1(x, x – 1))), x – 1)End Sub程序运行后,单击命令按钮,输出结果是()。
A. 10
B. 0
C. 11
D. 21
正确答案: B
Tag:VisualBasic程序设计 按钮 命令
时间:2021-11-29 15:20:46
- 上一篇:以下是一个能返回数组a中最大数的函数过程代码: Function maxval(a() As Integer) As Integer Dim max% max = 1 For i = 2 To 10 If a(i) > a(max) Then max = i Next i maxval = max End Function Private Sub Command1_Click() Dim x(1 To 10) As Integer For i = 1 To 10 x(i) = Int(Rnd() 1
- 下一篇:下面程序的运行结果为()。Dim a%, b%, c%Sub p1(x%, y%) Dim c As Integer x = 2 x: y = y + 2: c = x + yEnd SubSub p2(x%, ByVal y%) Dim c As Integer x = 2 * x: y = y + 2: c = x + yEnd SubPrivate Sub Command1_Click() a = 2: b = 4: c = 6 Call p1(a, b) Call p2(a, b) Print a