Re: [問題] 二維陣列如何存入.txt檔

看板C_and_CPP (C/C++)作者 (好人超)時間16年前 (2009/12/27 21:13), 編輯推噓1(102)
留言3則, 1人參與, 最新討論串2/2 (看更多)
string pos_table[120][5]; for(i=0;i<120;i++){ for(int j=0;j<5;j++){ fprintf(fptr, "%d,",pos_table[i][j].c_str()); } }

12/27 21:07,
不好意思,其實我在全域變數定義過:
12/27 21:07
arno855268:int pos_table[120][5]={-1}; 12/27 21:07 所以你定義了兩個 pos_table 嗎? 可是你的迴圈裡永遠只看得到上面紅色的 string pos_table[120][5] 而看不到你全域的 int pos_table[120][5] 喔... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.117.171.46

12/27 21:20, , 1F
ㄜㄜ...白癡了我XD
12/27 21:20, 1F

12/27 21:20, , 2F
我把string pos_table[120][5];刪掉就搞定了!
12/27 21:20, 2F

12/27 21:20, , 3F
謝謝各位...
12/27 21:20, 3F
文章代碼(AID): #1BDrrWrb (C_and_CPP)
討論串 (同標題文章)
文章代碼(AID): #1BDrrWrb (C_and_CPP)