我的程式碼是:
Dim line as String
For i = 0 To 49
line = line + Str(Int(Rnd(i) * 2))
Next i
Print line
輸出結果是0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0 0 ......(有50位)
但每個數字被空格隔開了
如果我想要輸出01001010011101011000...
請問要如何修正
2006-05-30 09:54:12 · 3 個解答 · 發問者 小維 1 in 電腦與網際網路 ➔ 程式設計
Dim line As String = ""
Dim i As Integer
For i = 0 To 49
line += CStr(CInt(Rnd(2)))
Next i
MsgBox(line)
2006-06-02 18:01:33 補充:
^__^ 你真是個好人~ 謝謝啦~
(ps這個評價有bug~哈哈~)
2006-05-30 11:22:13 · answer #1 · answered by 文澳寶 4 · 0⤊ 0⤋
Dim line As StringFor i = 0 To 49 line = line + Trim(Str(Int(Rnd(i) * 2)))Next iPrint line
2006-05-30 13:56:35 · answer #2 · answered by 世賢 7 · 0⤊ 0⤋
Dim Line As StringFor i = 0 To 49 Line = Line & Int(Rnd(i) * 2)Next i
2006-05-30 11:17:37 · answer #3 · answered by W.J.S. 7 · 0⤊ 0⤋