Re: [問題] 將二維陣列放進list與取出
您是不是想表達這樣?
list<int[3][3]> queue;
// list<int[3][3]> temp;
list<int[3][3]>::iterator tmpiter;
int initial[3][3]={{1,2,3},{4,0,6},{7,8,5}};
queue.push_front(initial);
// temp=queue.begin();
tmpiter = queue.begin();
for(;tmpiter != queue.end(); ++tmpiter){
for(int i=0;i<3; ++i){
for(int j=0; j<3; ++j){
cout << (*tmpiter)[i][j] << " ";
}
}
}
/*
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.109.23.218
推
04/08 20:49, , 1F
04/08 20:49, 1F
→
04/08 20:50, , 2F
04/08 20:50, 2F
→
04/08 21:01, , 3F
04/08 21:01, 3F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):