我是靠谱客的博主 哭泣紫菜,这篇文章主要介绍for 对vector类型进行循环输出,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream> using namespace std; int main(void) { vector<string> svec; svec.push_back("I"); svec.push_back("LOVE"); svec.push_back("C++"); for (vector<string>::size_type ind = 0;ind != svec.size(); ++ind) { cout << svec[ind]; // print current element // if not the last element, print a space to separate from the next one if (ind + 1 != svec.size()) cout << " "; } return 0; }

最后

以上就是哭泣紫菜最近收集整理的关于for 对vector类型进行循环输出的全部内容,更多相关for内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(48)

评论列表共有 0 条评论

立即
投稿
返回
顶部