[問題] 將二維陣列放進list與取出

看板C_and_CPP (C/C++)作者 (Foolie)時間16年前 (2010/04/08 19:36), 編輯推噓1(103)
留言4則, 4人參與, 最新討論串1/2 (看更多)
list<int[3][3]> queue; list<int[3][3]> temp; int initial[3][3]={{1,2,3},{4,0,6},{7,8,5}}; queue.push_front(initial); temp=queue.begin(); while(queue.size()!=0) {for(int i=0;i<3;i++) for(int j=0;j<3;j++) { cout<<temp[i][j]<<" "; } queue.pop_front(); } 應該蠻多地方有問題 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.229.194

04/08 20:17, , 1F
那你的問題在哪裡?? code這樣寫對不對??
04/08 20:17, 1F

04/08 20:19, , 2F
typedef struct {int ary[3][3]} ARY; list<ARY> tmp;
04/08 20:19, 2F

04/08 20:54, , 3F
我的問題是 如何 將二維陣列存到queue裡面
04/08 20:54, 3F

04/08 21:02, , 4F
2f正解
04/08 21:02, 4F
文章代碼(AID): #1BlR--ai (C_and_CPP)
文章代碼(AID): #1BlR--ai (C_and_CPP)