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

想請問假如輸出結果是
     0
    101
   21012
  3210123
 432101234
54321012345
 432101234
  3210123
   21012
    101
     0
那麼應該如何寫出可以輸出這種型態的資料

2007-01-22 06:19:14 · 2 個解答 · 發問者 菜頭 1 in 電腦與網際網路 程式設計

謝謝你們喔
另外 為什麼我每次輸入資料都會取代掉後面的程式..

2007-01-25 06:00:47 · update #1

為何需要space , 還是我間隔太大嚕?

2007-01-25 07:11:42 · update #2

2 個解答

那我來用2005寫吧...
Dim I%, J%, Temp$
For I = -5 To 5
Temp = ""
For J = -5 To 5
Temp &= IIf(Math.Abs(I) + Math.Abs(J) > 5, " ", Math.Abs(J))
Next
Debug.Print(Temp)
Next
'--------------------------------------------
若你要印出的是"全形"數字只要把中間那行
Temp &= IIf(Math.Abs(I) + Math.Abs(J) > 5, " ", Math.Abs(J))
改成
Temp &= IIf(Math.Abs(I) + Math.Abs(J) > 5, " ", Chr(-23889 + Math.Abs(J)))
就可以了.....

2007-01-26 01:25:16 補充:
[為什麼我每次輸入資料都會取代掉後面的程式]
雖然我看不太懂你在問什麼...
不過我猜你是按到[Insert]鍵了.......
另外第二個問題就真的完全不知道在問什麼了...

2007-01-23 09:02:16 · answer #1 · answered by 幽靈 5 · 0 0

Private Sub Command1_Click()
Dim i, j, k, m, n, d As Integer
Dim buf As String
m = 0: n = 5: d = 1: k = 0
step2:
For i = m To n Step d
buf = Space(10 - i * 2)
For j = i To 0 Step -1
buf = buf & j & " "
Next j
For j = 1 To i
buf = buf & j & " "
Next j
Print buf
Next i
If (k = 0) Then
m = 4: n = 0: d = -1: k = 1
GoTo step2
End If
End Sub
如果有問題, 請來函討論. 不然, 我可能會錯失你再補充的疑點.

2007-01-22 23:34:10 · answer #2 · answered by JJ 7 · 0 0

fedest.com, questions and answers