作业帮 > 综合 > 作业

Private Sub Command1_Click() s = p(1) + p(2) + p(3) + p(4) P

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/18 21:15:19
Private Sub Command1_Click() s = p(1) + p(2) + p(3) + p(4) Print s;
Private Sub Command1_Click()
s = p(1) + p(2) + p(3) + p(4)
Print s;
End Sub
Public Function p(n As Integer)
Static sum
For I = 1 To n
sum = sum + I
Next I
p = sum
End Function
Private Sub Command1_Click() s = p(1) + p(2) + p(3) + p(4) P
static sum 是静态的变量,他不会自动清空.p(1)=0+1=1;p(2)=sum+1+1=3;p(3)=sum+1+1+1=6;t同理p(4)=10;s=1+3+6+10=20.我把vb放下很久了.试着做一下.
答案是:20.