'cosx=1-x^2/2!+x^4/4!.+x^(2n)/(2n)!我写的代码:
Private Sub Command1_Click()
Dim x As Double, t As Double, s As Double, n As Integer, jc As Double
x = Val(Text1.Text)
s = 1: t = 1: n = 1
Do
jc = 1
For i = 1 To 2 * n
jc = jc * i
Next i
t = (-1) ^ n * (x ^ (2 * n)) / jc'这里是阶乘,你用的公式是连加的公式
s = t + s
n = n + 1
Loop Until t <= 10 ^ (-7) And t >= -10 ^ (-7)
Text2.Text = s
End Su