📄 求阶乘过程.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "例[8-1]子过程——求n!"
ClientHeight = 1455
ClientLeft = 60
ClientTop = 345
ClientWidth = 4215
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 1455
ScaleWidth = 4215
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2760
TabIndex = 3
Top = 885
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1920
TabIndex = 0
Top = 885
Width = 615
End
Begin VB.Label Label1
Caption = "请输入一个正整数:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 180
TabIndex = 2
Top = 1005
Width = 1695
End
Begin VB.Label Label2
Alignment = 2 'Center
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 1
Top = 360
Width = 3855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Call N(Val(Text1.Text))
End Sub
'求阶乘n!的子过程
Public Sub N(a As Integer)
Dim i As Integer
Dim f As Double
f = 1
For i = 1 To a
f = f * i
Next i
Form1.Label2.Caption = Str(a) & "!的值为:" & Str(f)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -