vb问题.请求解答~急~

来源:百度知道 编辑:UC知道 时间:2024/05/13 04:31:32
option explicit
private sub command1_click()
dim a as integer ,a as integer
for i=1to 3
a=a*i
print fun1(a)
nexti
end sub
private function fun1(t as integer )as single
static y as single
y=y+t
t=y+1
fun1=t
end function 问题是:文本框显示几行数据,分别是多少呢?

修改为
Option Explicit

Private Sub command1_click()
Dim a As Integer, i As Integer
For i = 1 To 3
a = a * i
Print fun1(a)
Next i
End Sub
Private Function fun1(t As Integer) As Single
Static y As Single
y = y + t
t = y + 1
fun1 = t
End Function

结果为
1
3
12
再点为
12
36
144