求教扬辉三角程序
求教事例
[解决办法]
程序员试题
Private Sub Form_Click()
Dim i, j, c As Integer, strtemp As String
Dim a(9) As Integer
a(0) = 0
a(1) = 1
strtemp = Str(a(1)) + Space(3)
CurrentX = (ScaleWidth - TextWidth(strtemp)) / 2
Print strtemp
For j = 2 To 9
a(j) = 1
For c = j - 1 To 2 Step -1
a(c) = a(c) + a(c - 1)
Next
strtemp = " "
For c = 1 To j
strtemp = strtemp & Str(a(c)) & Space(5 - Len(Str(a(c))))
Next
CurrentX = (ScaleWidth - TextWidth(strtemp)) / 2
Print strtemp
Next
End Sub