C++ 编程中的输出迭代器
在本教程中,我们将讨论一个程序来理解 C++ 中的输出迭代器。
输出迭代器是五个主要迭代器的一部分。它们与输入迭代器相反,可以为其分配值,但不能访问以获取值。
示例
#include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int>v1 = {1, 2, 3, 4, 5};
//declaring iterator
vector<int>::iterator i1;
for (i1=v1.begin();i1!=v1.end();++i1){
*i1 = 1;
}
return 0;
}输出
No output, because we cannot access values of output operators
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP