看板 Programming 關於我們 聯絡資訊
原始程式碼我放在這裡 http://www.badongo.com/file/3068247 我用 Microsoft Visual C++ 6.0 compile 時 顯示的錯誤訊如下 ------------------Configuration: Array test - Win32 Debug-------------------- 這部分已解決,感謝james732的熱心回信 ^^ ----------------------------------------------------------------------------- 另外想問的是 int response[ SIZE ] = { 6, 7, 8, 9, 8, 7, 8, 9, 8, 9, 7, 8, 9, 5, 9, 8, 7, 8, 7, 8, 6, 7, 8, 9, 3, 9, 8, 7, 8, 7, 7, 8, 9, 8, 9, 8, 9, 7, 8, 9, 6, 7, 8, 7, 8, 7, 9, 8, 9, 2, 7, 8, 9, 8, 9, 8, 9, 7, 5, 3, 5, 6, 7, 2, 5, 3, 9, 4, 6, 4, 7, 8, 9, 6, 8, 7, 8, 9, 7, 8, 7, 4, 4, 2, 5, 3, 8, 7, 5, 6, 4, 5, 6, 1, 6, 5, 7, 8, 7 }; 如上,如果我改為 #define SIZE 21 (原本是SIZE 99) 然後想把一開始 int response[ SIZE ] = {......}中的數字 改為由系統自動產生亂數1~9。 也就是 建立一個integer type (int) 的Array,SIZE為21 Array的Elements是亂數產生的介於1~9之間的整數 的話,要怎麼改呢? 我很天真地寫下... int content; srand(time(NULL)); content = ( rand( )%9 )+1; int response[ SIZE ] = { content }; 結果完全行不通...(可見我是超新手...) 麻煩大家了,謝謝^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.216.102 ※ 編輯: elle0001tw 來自: 140.114.216.102 (05/16 23:24)
raptorevo:有學到迴圈了嗎@@?得用迴圈去run喔 61.217.194.222 05/17 00:59