Private Sub Command1_Click() '等腰三角形
Dim i As Integer, n As Integer
n = 5
For i = 1 To n
Print Space(n - i) String(2 * i - 1, "*")
Next
End Sub
Private Sub Command2_Click() '正方形
Dim i As Integer, n As Integer
n = 5
For i = 1 To n
For j = 1 To n
Print "* "
Next
Next
End Sub
Private Sub Command3_Click() '等腰梯形
Dim i As Integer, n As Integer, m As Integer
n = 5
m = 5
For i = 1 To n
Print Space(n - i) String(2 * i - 1 + m, "*")
Next
End Sub
'S=(上底+下底)×高÷2Private Sub Form_Load()
Me.Show
a = Val(InputBox("请输入梯形上底"))
b = Val(InputBox("请输入梯形下底"))
h = Val(InputBox("请输入梯形的高"))
Print "梯形上底="a
Print "梯形下底="b
Print "梯形高="h
Print "梯形面积="(a + b) * h / 2
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)