practice7_10.frm
来自「深圳大学的vb上机与教学的课件」· FRM 代码 · 共 38 行
FRM
38 行
VERSION 5.00
Begin VB.Form Form1
Caption = "打印杨辉三角"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a() As Double, n As Double
Private Sub Form_click()
Form1.Cls
n = InputBox("请输入行数", "行数", "0")
ReDim a(1 To n, 0 To n) As Double
For i = 1 To n
a(i, 0) = 0
a(i, 1) = 1
a(i, i) = 1
For j = 1 To i - 1
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
Next j
Next i
For i = 1 To n
For j = 1 To i
Print Format(a(i, j), "!@@@@@@");
Next j
Print
Next i
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?