飛飛(七十三)阅读 STL中的简单容器和迭代器
来源:互联网 发布:知乎 美国 编辑:程序博客网 时间:2024/06/07 23:10
/**Copyright (c) 2016,烟台大学计算机学院*All rights reserved.*文件名称:test.cpp*作 者:李飞*完成日期:2016年 6月 17日*版 本 号:1.0**问题描述:阅读 STL中的简单容器和迭代器*输入描述:*程序输出:*/#include <iostream>#include <vector>using namespace std;int main(){ vector<int> intList; vector<int>::iterator listIt; int i; intList.push_back(1); intList.push_back(5); intList.push_back(10); intList.push_back(15); cout<<"Line 1: List Elements: "; for(i=0; i<4; i++) cout<<intList[i]<<" "; cout<<endl; for(i=0; i<4; i++) intList[i] *=2; cout<<"Line 2: List Elements: "; for(listIt=intList.begin(); listIt != intList.end(); ++listIt) cout<<*listIt<<" "; cout<<endl; listIt=intList.begin(); ++listIt; ++listIt; intList.insert(listIt,8); cout<<"Line 3: List Elements: "; for(listIt = intList.begin(); listIt != intList.end(); ++listIt) cout<<*listIt<<" "; cout<<endl; return 0;}
<img src="http://img.blog.csdn.net/20160617175651667?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
0 0
- 飛飛(七十三)阅读 STL中的简单容器和迭代器
- 飛飛(七十二)阅读 STL中的简单容器和迭代器
- 飛飛(七十四)阅读 STL中的简单容器和迭代器
- C++走向远洋——60(十四周阅读程序、STL中的简单容器和迭代器)
- 2015级C++第14周程序阅读 STL中的简单容器和迭代器
- STL中的简单容器和迭代器
- STL 容器和迭代器基础
- STL向导阅读③----容器.
- C++STL中的set容器和map容器
- stl容器简单总结
- STL容器简单描述
- 标准C++STL中的容器类简单介绍
- STL中的容器、迭代器与算法
- STL 中的容器们(三)
- STL 中的容器们(四)
- STL 中的容器们 (二)
- 所有STL中的容器(摘抄)
- 浅谈STL中的容器
- linux系统配置
- 模式识别(Pattern Recognition)学习笔记(三十二)-- 逻辑回归
- 前端开发部署
- 一个简单的Java对象池实现——可用来解决SimpleDateFormat的线程安全问题
- hexo和github更配
- 飛飛(七十三)阅读 STL中的简单容器和迭代器
- C3p0
- select模型
- 点击tabbar选项返回当前viewController最顶层
- j2ee13个规范总结
- 设置正确的线程数量
- 《教程要点》
- Android比较难搞的几点
- 基本术语-学习笔记