這堤程式出來是九九乘法表ㄉ 一排三列 我要改成1牌友4列ㄉ把程式打給我ㄅ~亟需
Private Sub Form_Activate()
Dim i As Integer, j As Integer
For i = 1 To 7 Step 3
For j = 1 To 9
Print Space(4);
Print i & " X " & j & " = " & i * j,
Print i 1 & " X " & j & " = " & (i 1) * j,
Print i 2 & " X " & j & " = " & (i 2) * j
Next j
Print
Next i
End Sub
2005-12-15 10:49:17 · 3 個解答 · 發問者 ? 1 in 電腦與網際網路 ➔ 程式設計
誇糊裏面市+法
2005-12-15 10:51:14 · update #1
step 後面改成4多加一行 Print i+3 & " X " & j & " = " & (i+3) * j
2005-12-15 11:42:07 · answer #1 · answered by ? 5 · 0⤊ 0⤋
Private Sub Command1_Click()
Prt 4
End Sub
Sub Prt(Lev As Integer)
Dim I As Integer, J As Integer, Y As Integer
If Lev < 1 Or Lev > 9 Then Exit Sub
Cls
For I = 1 To 9 Step Lev
For J = 1 To 9
Y = 0
Do Until Lev - 1 = Y
If I + Y < 9 Then
Print I + Y & " X " & J & " = " & (I + Y) * J,
ElseIf I + Y = 9 Then
Print I + Y & " X " & J & " = " & (I + Y) * J
End If
Y = Y + 1
Loop
If I + Y < 10 Then Print I + Y & " X " & J & " = " & (I + Y) * J
Next
Print
Next
End Sub
2005-12-15 13:38:35 · answer #2 · answered by W.J.S. 7 · 0⤊ 0⤋
1.第一層的for loop要改成1 to 9, step設為4,
2.由於一排要列4個, 所以第一列和第二列都會印4個, 而第三列只有一個
所以列印時加個判斷, 才不會印成 9* 12法表哦
Private Sub Form_Activate()
Dim i As Integer, j As Integer
For i = 1 To 9 Step 4
For j = 1 To 9
If i <> 9 Then
Print i & " X " & j & " = " & i * j & " " & (i + 1) & " X " & j & " = " & (i + 1) * j & " " & (i + 2) & " X " & j & " = " & (i + 2) * j & " " & (i + 3) & " X " & j & " = " & (i + 3) * j
Else
Print i & " X " & j & " = " & i * j
End If
Next j
Next i
End Sub
2005-12-15 12:58:47 · answer #3 · answered by Anonymous · 0⤊ 0⤋