list用法2
来源:互联网 发布:通达信电脑炒股软件 编辑:程序博客网 时间:2024/06/05 08:02
# include <iostream># include <list>using namespace std; void PrintListContents(const list<int> & listInput);int main(){ list<int> a; a.push_front(4); a.push_front(3); list<int>::iterator iter; //iter = a.push_front(2); a.push_front(2); a.push_back(1); a.push_front(0); //PrintListContents(a); //删除 // iterator erase( iterator pos ); // iterator erase( iterator start, iterator end ); //删除指定的元素 list<int>::iterator it = a.begin(); a.erase(a.begin()); list<int> b; b.push_front(6); b.push_front(10); b.push_front(-1); //排序 b.sort(); PrintListContents(b); //反转 b.reverse(); //PrintListContents(b); return 0;} void PrintListContents(const list<int> & listInput){ //不加空间名也可以,因为已经 using namespace std; list<int>::const_iterator iter; for(iter=listInput.begin();iter!=listInput.end();iter++){ cout<<*iter<<endl; }}
0 0
- list用法2
- List用法
- List用法
- list 用法
- list用法
- list用法
- list用法
- List<>用法
- list 用法
- List 用法
- list用法
- list 用法
- list用法
- List<>用法
- list 用法
- List用法
- List用法
- list用法
- 快排划分算法求k个数小于某数
- Cheapest Palindrome(区间DP)
- iOS中多线程的实现方案之pthread和NSThread
- SDOI(模拟)
- UVA 11235 Frequent values(RMQ)
- list用法2
- Reorder the Books(模拟)
- 位操作-在寄存器中的使用
- 月光族的最佳财务规划
- Swing下的二维随机游走轨道模拟
- 线程池原理(讲的非常棒)
- 线段覆盖
- caffe windwos安装测试相关问题
- 两个栈实现一个顺序栈