求vb菱形代码!!急!!!
请在空格里填空,谢谢!!PrivateSubPicture4_Click()Picture4.PrintFori=__To__Forj=__To___Picture4.P...
请在空格里填空,谢谢!!
Private Sub Picture4_Click()
Picture4.Print
For i = __ To __
For j = __ To ___
Picture4.Print Tab(________); "*";
Next j
Picture4.Print
Next i
End Sub 展开
Private Sub Picture4_Click()
Picture4.Print
For i = __ To __
For j = __ To ___
Picture4.Print Tab(________); "*";
Next j
Picture4.Print
Next i
End Sub 展开
展开全部
Dim i, n1, n2, a(100, 100) As Integer
Private Sub Form_Load()
i = -1: n = 0
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = i + 1
Select Case i
Case 0 '画菱形
Cls
For n1 = -9 To 9
For n2 = 1 To (9 - Abs(n1) + 1)
Print Tab((n2) * 2 + Abs(n1) + 9); "*";
Next n2
Print
Next n1
Case 1 '画方
Cls
For n1 = 1 To 10
For n2 = 1 To 10
Print Tab(n2 * 2); "*";
Next n2
Print
Next n1
Case 2 '画三角
Cls
For n1 = 1 To 10
For n2 = 1 To (10 - n1)
Print Tab(n2 * 2); "*";
Next n2
Print
Next n1
Case 3 '画三角
Cls
For n1 = 1 To 10
For n2 = n1 To 1 Step -1
Print Tab((10 - n2) * 2 + 2); "*";
Next n2
Print
Next n1
Case 4 '画漏斗
Cls
For n1 = -9 To 9
For n2 = 1 To (Abs(n1) + 1)
Print Tab((n2) * 2 - Abs(n1) + 9); "*";
Next n2
Print
Next n1
Case 5 '画图
Cls
'*************************** 画方
For n1 = 0 To 10
For n2 = 0 To 12
a(n1, n2) = (n2) * 2
Next n2
Next n1
'*************************** 方中掏出菱形
For n1 = 1 To 9
For n2 = 1 To (2 * (5 - Abs(5 - n1)))
a(n1, n2 + Abs(5 - n1) + 1) = 0
Next n2
Next n1
'*************************** 菱形中画方
For n1 = 3 To 7
For n2 = 4 To 9
a(n1, n2) = (n2) * 2
Next n2
Next n1
'*************************** 方中掏出方
For n1 = 4 To 6
For n2 = 5 To 8
a(n1, n2) = 0
Next n2
Next n1
'*************************** 画出图象
For n1 = 0 To 10
For n2 = 0 To 12
If a(n1, n2) <> 0 Then
Print Tab(a(n1, n2)); "*";
End If
Next n2
Print
Next n1
Case 6 '画曲线
Cls
For n1 = 1 To 3
For n2 = 0 To 6 Step (3.14 / 8)
Print Tab(10 * Sin(n2) + 18); "*"
Next n2
Next n1
Case 7 '画双曲线
Cls
For n1 = 1 To 3
For n2 = 0 To 6 Step (3.14 / 8)
Print Tab(10 * Sin(n2) + 18); "*"
Print Tab(10 * Cos(n2) + 18); "*"
Next n2
Next n1
i = 0
End Select
End Sub
Private Sub Form_Load()
i = -1: n = 0
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = i + 1
Select Case i
Case 0 '画菱形
Cls
For n1 = -9 To 9
For n2 = 1 To (9 - Abs(n1) + 1)
Print Tab((n2) * 2 + Abs(n1) + 9); "*";
Next n2
Next n1
Case 1 '画方
Cls
For n1 = 1 To 10
For n2 = 1 To 10
Print Tab(n2 * 2); "*";
Next n2
Next n1
Case 2 '画三角
Cls
For n1 = 1 To 10
For n2 = 1 To (10 - n1)
Print Tab(n2 * 2); "*";
Next n2
Next n1
Case 3 '画三角
Cls
For n1 = 1 To 10
For n2 = n1 To 1 Step -1
Print Tab((10 - n2) * 2 + 2); "*";
Next n2
Next n1
Case 4 '画漏斗
Cls
For n1 = -9 To 9
For n2 = 1 To (Abs(n1) + 1)
Print Tab((n2) * 2 - Abs(n1) + 9); "*";
Next n2
Next n1
Case 5 '画图
Cls
'*************************** 画方
For n1 = 0 To 10
For n2 = 0 To 12
a(n1, n2) = (n2) * 2
Next n2
Next n1
'*************************** 方中掏出菱形
For n1 = 1 To 9
For n2 = 1 To (2 * (5 - Abs(5 - n1)))
a(n1, n2 + Abs(5 - n1) + 1) = 0
Next n2
Next n1
'*************************** 菱形中画方
For n1 = 3 To 7
For n2 = 4 To 9
a(n1, n2) = (n2) * 2
Next n2
Next n1
'*************************** 方中掏出方
For n1 = 4 To 6
For n2 = 5 To 8
a(n1, n2) = 0
Next n2
Next n1
'*************************** 画出图象
For n1 = 0 To 10
For n2 = 0 To 12
If a(n1, n2) <> 0 Then
Print Tab(a(n1, n2)); "*";
End If
Next n2
Next n1
Case 6 '画曲线
Cls
For n1 = 1 To 3
For n2 = 0 To 6 Step (3.14 / 8)
Print Tab(10 * Sin(n2) + 18); "*"
Next n2
Next n1
Case 7 '画双曲线
Cls
For n1 = 1 To 3
For n2 = 0 To 6 Step (3.14 / 8)
Print Tab(10 * Sin(n2) + 18); "*"
Print Tab(10 * Cos(n2) + 18); "*"
Next n2
Next n1
i = 0
End Select
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询