Re: [ASP ] 想寫個像樂透的程式但是遇到了瓶頸

看板Visual_Basic作者 (姚呵呵)時間16年前 (2008/04/01 01:38), 編輯推噓2(201)
留言3則, 2人參與, 最新討論串5/5 (看更多)
前面講的取球法若覺得不好寫, 可以用洗牌法簡單做出來. 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

04/01 03:39, , 1F
抓個小錯誤 第10行 應該是Int
04/01 03:39, 1F

04/01 13:25, , 2F
手誤
04/01 13:25, 2F

04/02 07:12, , 3F
呵呵~~看懂了 謝謝分享
04/02 07:12, 3F
文章代碼(AID): #17yI6ikc (Visual_Basic)
討論串 (同標題文章)
文章代碼(AID): #17yI6ikc (Visual_Basic)