5.6要怎么做啊啊啊啊啊啊

 我来答
数学与计算机编程
2017-05-24 · TA获得超过2160个赞
知道大有可为答主
回答量:2312
采纳率:80%
帮助的人:576万
展开全部

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 "调用函数过程:"

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

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式