社区
C++ 语言
帖子详情
STL中的iterator配合Vector怎么用??
xinxin12375
2006-12-13 05:07:19
RT.请各位给点示例代码。
...全文
171
5
打赏
收藏
STL中的iterator配合Vector怎么用??
RT.请各位给点示例代码。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
sankt
2006-12-22
打赏
举报
回复
vector<int> the_vector;
vector<int>::iterator the_iterator;
for( int i=0; i < 10; i++ )
the_vector.push_back(i);
int total = 0;
the_iterator = the_vector.begin();
while( the_iterator != the_vector.end() )
{
total += *the_iterator;
the_iterator++;
}
cout << "Total=" << total << endl;
AI风
2006-12-22
打赏
举报
回复
vector<int> vec;
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
vector<int>::iterator it;
for(it = vec.begin(); it != vec.end(); ++it)
{
cout << *it << endl;
}
输出:
1
2
3
ReverseEngineering
2006-12-22
打赏
举报
回复
迭代器?
其实就个整数!
gooderfeng
2006-12-13
打赏
举报
回复
vector<T> t;
find(t.begin(), t.end(), value);
ppzine
2006-12-13
打赏
举报
回复
vector<string> vec;
vec.inster(string("aa"));
vector<string>::iterator it=vec.begin();
cout<<(*it).c_str()<<endl;
C++
STL
学习?
vector
这篇博客在简单介绍
STL
的情况下,会详细的来介绍
vector
的使用。
STL
共有六大组件: 一。容器(Container):是一种数据结构,如list,
vector
,deque,queue等,以模板类的方法提供,为了访问容器
中
的数据,...
C++标准模板库
STL
初步(1)
组成的库来说提供了更好的代码重用...在C++标准
中
,
STL
被组织为下面的几个头文件:、<
vector
>、、、、<
iterator
>、、、、、、、和。文件
中
主要介绍了前面八个的使用,并且重点介绍了他们的属性和一些成员函数的使用。
C++
STL
函数应用
C++
STL
函数算法精讲+刷题实战,包括16个常用
STL
函数,
vector
/stack/queue/deque/priority_queue、list/bitset/set/multiset/map/multimap等函数应用和刷题实战。
stl
练习资料
stl
练习
vector
map
iterator
操作。
vector
链表实现,
STL
如果将节点变为数组,将会常熟优化。
vector
链表实现。...拥有
iterator
,begin,end,rbegin,rend,operator[],push_back,pop_back,push_front,pop_front,size等海量函数以及
STL
函数支持,也支持RE判断!
C++ 语言
64,648
社区成员
250,476
社区内容
发帖
与我相关
我的任务
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
分享
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下
试试用AI创作助手写篇文章吧
+ 用AI写文章