English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

請問一下怎麼用*排成一個菱形就用1個3個5個3個1個這樣排出來要怎麼寫壓

2006-10-26 05:10:29 · 3 個解答 · 發問者 易霖 1 in 電腦與網際網路 程式設計

.....忘了說不可以用強制的

2006-10-26 05:29:24 · update #1

3 個解答

Private Sub Command1_Click()
Dim i, j, star As Integer
For i = 1 To 5
Print Spc(Abs(3 - i));
If i <= 3 Then
star = (i - 1) * 2 + 1
Else
star = (5 - i) * 2 + 1
End If
For j = 1 To star
Print "*";
Next j
Print
Next i
End Sub

2006-10-26 11:14:56 · answer #1 · answered by Simple Life 4 · 0 0

請到http://tw.knowledge.yahoo.com/question/?qid=1206102510115參考!
才解決不了多久!

2006-10-26 05:40:54 · answer #2 · answered by 5 · 0 0

Print(" *")
Print(" ***")
Print("*****")
Print(" ***")
Print(" *")

2006-10-27 10:45:42 補充:
這個也行Dim i, j As Integers = " *****"For i = 1 To 5If i > 3 Then j = 6 - i Else j = iPrint Mid(s, j, j + 2)Next i

2006-10-26 05:26:28 · answer #3 · answered by ray 4 · 0 0

fedest.com, questions and answers