看板 Visual_Basic 關於我們 聯絡資訊
前面講的取球法若覺得不好寫, 可以用洗牌法簡單做出來. dim ar(41) as integer, i as integer for i = 0 to 41 ar(i) = i+1 next i randomize() for i = 1 to 400 dim x as integer, y as integer dim temp as integer x = int(rnd() * 42) y = iny(rnd() * 42) temp = ar(x) ar(x) = ar(y) ar(y) = temp next i for i = 0 to 6 console.write(" {0} ", ar(i)) next i 單組一定數字不重覆, 二組以上要多寫點程式檢查組與組的重覆. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.160.212.10
xtimer:抓個小錯誤 第10行 應該是Int 04/01 03:39
yauhh:手誤 04/01 13:25
xtimer:呵呵~~看懂了 謝謝分享 04/02 07:12