当前位置:首页 >> 数学 >>

VB金字塔几种常用编程方法


(1)Private Sub Command1_Click() 'For i = 1 To 9 ' Print Tab(10 - i); String(2 * i - 1, Trim(Str(i))) 'Next i For i = 1 To 9 Print Tab(10 - i); String(2 * i - 1, CStr(i)) Next i

End Sub (2) Private Sub Command2_Click() 'For i = 1 To 9 ' Print Tab(10 - i); ' For m = 1 To 2 * i - 1 ' Print Trim(Str(i)); ' Next m ' Print 'Next i

For i = 1 To 9 Print Tab(10 - i); For m = 1 To 2 * i - 1 Print CStr(i); Next m Print Next i End Sub (3)Private Sub Command3_Click() For i = 1 To 9 '输入的数字金字塔的塔高 n(1-9) For j = 1 To 9 - i Print " "; '输出空格 Next j For j = 1 To 2 * i - 1 Print CStr(i); '输出数字字符 Next j Print '换行 Next i

End Sub (4)Private Sub Command4_Click() For i = 9 To 1 Step -1 Print Tab(10 - i); String(2 * i - 1, Chr(64 + 10 - i)) Next i End Sub Private Sub Command5_Click() For i = 1 To 17 Print Spc(Abs(9 - i)); String(17 - 2 * Abs(9 i), CStr(9 - Abs(i - 9))) Next i End Sub (6)Private Sub Command6_Click() For i = 1 To 9 '输入的数字金字塔的塔高 n(1-9) For j = 1 To i Print " "; '输出空格

Next j For j = 1 To 18 - 2 * i + 1 Print CStr(i); '输出数字字符 Print Chr(i + 64); Next j Print '换行 Next i End Sub (7)Private Sub Command7_Click() For i = 1 To 9 Print Tab(10 - i); String(2 * i - 1, Trim(Str(i))) Next i For i = 8 To 1 Step -1 Print Tab(10 - i); String(2 * i - 1, Trim(i)) Next i End Sub (8)Private Sub Command8_Click()

Form1.Cls End Sub


赞助商链接
相关文章:
08-09(2)VB期末A卷
08-09(2)VB期末A卷_理学_高等教育_教育专区。08...4、CLS 是窗体的一个方法。 5、移动框架时框架内...第 3 页 程序 4.下面的数字金字塔显示程序中有三...
更多相关标签: