#include <iostream>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <string>
#include <cstdlib>
using namespace std;
int main ()
{
#if 1
list< deque<int> > s;
int iarray[] = {1, 2, 3, 4, 5};
list<int> ilist(iarray, iarray + 5);
for (list<int>::iterator iter = ilist.begin(); iter != ilist.end(); ++iter)
{
cout << *iter << endl;
}
for (list<int>::iterator iter = ilist.end(); iter != ilist.begin(); )
{
cout << *(--iter) << endl;//逆序输出
}
#endif
system("pause");
return 0;
}
C++ Primer Chapter 9 循环将list元素逆序输出
最新推荐文章于 2022-07-30 13:19:49 发布