5.6要怎么做啊啊啊啊啊啊
Private Sub Summation_Sub(ByVal x As Single)
Dim n As Integer, Sas As Double
n = 1
Do
S = S + x ^ (2 * n - 1) / Factorial(2 * n)
n = n + 1
Loop Until Abs(x ^ n / Factorial(2 * n)) < 10 ^ -6
Print "S(" & x & ")="; S
End Sub
Public Function Factorial(ByVal n As Integer) As Double
Factorial = 1
For i = 1 To n
Factorial = Factorial * i
Next i
End Function
Private Sub Form_Click()
Cls
Dim x As Single
x = InputBox("x=", , 1)
Print "调用子过程:"
Call Summation_Sub(x)
Print "调用函数过程:"
Print "S(" & x & ")="; Summation_Function(x)
End Sub
Public Function Summation_Function(ByVal x As Single)
Dim n As Integer
n = 1
Do
Summation_Function = Summation_Function + x ^ (2 * n - 1) / Factorial(2 * n)
n = n + 1
Loop Until Abs(x ^ n / Factorial(2 * n)) < 10 ^ -6
End Function