求s.frm
来自「算法教案」· FRM 代码 · 共 70 行
FRM
70 行
VERSION 5.00
Begin VB.Form Form1
Caption = "阶乘"
ClientHeight = 2865
ClientLeft = 60
ClientTop = 450
ClientWidth = 4560
LinkTopic = "Form1"
ScaleHeight = 2865
ScaleWidth = 4560
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text2
Height = 375
Left = 2040
Locked = -1 'True
TabIndex = 4
Top = 1200
Width = 1935
End
Begin VB.TextBox Text1
Height = 375
Left = 2040
TabIndex = 2
Top = 480
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "计算"
Height = 495
Left = 1800
TabIndex = 0
Top = 2040
Width = 975
End
Begin VB.Label Label1
Caption = "结果:"
Height = 255
Left = 480
TabIndex = 3
Top = 1320
Width = 975
End
Begin VB.Label Label2
Caption = "输入正整数n:"
Height = 255
Left = 360
TabIndex = 1
Top = 600
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i, n As Integer
Dim j, s As Double
j = 1
s = 1
n = Val(Text1.Text)
For i = 2 To n
j = j / ((2 * i - 1) * (2 * i - 2))
s = s + ((-1) ^ (i - 1)) * j
Next i
Text2.Text = Str(s)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?