A-A+
设有如下程序: Private Static Function Fac(n As Integ
问题详情
设有如下程序: Private Static Function Fac(n As Integer)As Integer Dim f As Integer f=f+n Fac=f End Function Private Sub Form_Click() Dim I As Integer For 1=2 To 3 Print"#";I&“=”&Fac(1) Next I End Sub 程序运行后,单击窗体,在窗体上显示的是
A.#2=2 #3=3
B.#2=2 #3=5
C.#;2=2 #;3=3
D.#;2=2 #3;=5请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:B
解析:由于Print方法中的分号表示前后字符之间的连接,并不显示在窗体中,同时由于Function过程以Static定义,在I=3时,Fac(1)的值为5。