顺序容器 list 2
2016-04-13 19:37
162 查看
#include <iostream> #include <list> using namespace std; void PrintListContents(const list<int>& listInput); int main() { list<int> a; a.push_front(3); a.push_front(6); list<int>::iterator iElementValueTwo; iElementValueTwo = a.insert(a.begin(),31); a.push_front(12); PrintListContents(a); a.sort(); // sort 是排序, PrintListContents(a); a.reverse(); //reverse是翻转, PrintListContents(a); //a.erase(iElementValueTwo); // erase删除, //PrintListContents(a); a.erase(a.begin(),iElementValueTwo); PrintListContents(a); return 0; } void PrintListContents(const list<int>& listInput) { list<int>::const_iterator iter; for(iter = listInput.begin(); iter != listInput.end(); ++iter) cout << *iter << " "; cout << endl; }
相关文章推荐
- Monkey学习(1)环境搭建
- 团队计划backlog
- Ionic学习笔记5_动态组件指令
- 页面登录的用户名的回显
- JS-事件类型(鼠标事件中event对象的独有属性)
- Myeclipse2014 安装反编译插件
- leetcode-构造二叉树
- openwrt开发<3>开发入门
- DOM启蒙——第四章
- Ionic学习笔记4_ionic路由(页面切换)
- 团队项目计划BACKLOG
- bzoj 4358 permu
- xampp发布时,locaohost可以访问,局域网无法访问项目
- 使用ViewPager实现图片自动切换
- 蓝桥杯c语言B组题解
- Java Web项目中Maven管理jar包,如何用命令添加ja包!
- 团队项目计划BACKLOG
- C++primer 练习13.39
- 我的第一个存储过程
- Redis - 事务