当前位置:   article > 正文

C++遍历list元素_c++ list遍历

c++ list遍历
#include<list>
//define list
list<int> order1;		//record rack number
list<int> order2;		//record position in rack

//After order1.push_back() and order2.push_back() operations

list<int>::iterator iter1,iter2;
			
for (iter1 = order1.begin(); iter1 != order1.end(); iter1++)
{
	cout << "order1 = "<<*iter1 << endl;			
}
for (iter2 = order2.begin(); iter2 != order2.end(); iter2++)
{
	cout << "order2 = " << *iter2 << endl;
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/398956
推荐阅读
相关标签
  

闽ICP备14008679号