看板 Visual_Basic 關於我們 聯絡資訊
'顯示結果要對齊真難 Dim j As Integer Dim i As Integer Dim n As Integer Dim c1 As Double Dim c2 As Double Dim c3 As Double Private Sub Command1_Click() j = 1 n = InputBox("N層") Do Print Print Space(n * 3 - j * 2 - n * 1.2); '這邊的空格是用目測的 For i = 0 To j '要怎樣才能剛剛好? Call cxy(0, 0) c1 = cxy(j, j - i) Call cxy(0, 0) c2 = cxy(i, 0) c3 = c1 / c2 If c3 > 9 Then Print "" & c3; Else Print c3; End If Next j = j + 1 Loop Until j = n End Sub Function cxy(a As Integer, b As Integer) As Double If a > b Then cxy = cxy(a - 1, b) * a Else cxy = 1 End If End Function -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.231.58.120
fumizuki:me.fontname="細明體" 05/13 20:28
ILYY:謝謝 我知道了 05/14 10:53