2、運行程序單擊窗體,在窗體上顯示的內(nèi)容是:16 20
Private Sub Form_Click()
Dim n As Integer, m As Integer
n = 1: m = 2
Print n + m + f(n, m) ;
'優(yōu)先執(zhí)行f函數(shù),n,m變化后再運算 “+”
n = 2: m = 1
Print f(n, m) + f(m, n)
'n,m第一次變化后,第二次以變化后的值再調(diào)用
End Sub
Private Function f(n As Integer, m As Integer)
n = n + m
m = m + 3
f = n + m
End Function
3、執(zhí)行下面的程序,在窗體上顯示的輸出結(jié)果是______;如果將A語句改成:Call sub1(b+1,a),則在窗體上顯示的輸出結(jié)果是______。
Private Sub Form_Click()
Dim a As Integer, b As Integer
a = 1: b = 2
Call sub1(a, b) 'A
Print a, b
End Sub
Private Sub sub1(x As Integer, ByVal y As Integer)
x = x + y
y = x + y
End Sub
相關(guān)推薦:
2011年計算機等級考試二級VB基礎(chǔ)教程匯總
計算機等級考試二級VB二十套上機試題及答案
全國計算機等級考試二級VB筆試各題型答題技巧
計算機等級考試二級VB模擬試題及答案匯總