[問題] C語言作業的問題

看板Programming作者 (。。。)時間18年前 (2007/05/16 22:57), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/3 (看更多)
原始程式碼我放在這裡 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)

05/17 00:59, , 1F
有學到迴圈了嗎@@?得用迴圈去run喔
05/17 00:59, 1F
文章代碼(AID): #16InliLA (Programming)
文章代碼(AID): #16InliLA (Programming)