在VB中怎样利用自定义子过程计算1*2+2*3+3*4+4*5+5*6+6*7?
1个回答
展开全部
Private Sub zgc(x, diff) Dim i As Integer For i = 3 To x If i Mod 2 Then diff = diff - 1 / i Else diff = diff + 1 / i End If Next iEnd SubPrivate Function zhs(x) As Double Dim i As Integer For i = 3 To x If i Mod 2 Then diff = diff - 1 / i Else diff = diff + 1 / i End If Next i zhs = diffEnd FunctionPrivate Sub Command1_Click() Dim diff As Double diff = 0 zgc Val(Text1.Text), diff Print "子过程:e5a48de588b67a686964616f31333332623364"; diff diff = 0 diff = zhs(Val(Text1.Text)) Print "子函数:"; diffEnd Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询