- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Output Iterators in C++ programming
In this tutorial, we will be discussing a program to understand output iterators in C++.
Output iterators are a part of the major five iterators. They function opposite of the input iterators in a way that they can be assigned values but can’t be accessed to fetch values.
Example
#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; }
Output
No output, because we cannot access values of output operators
Advertisements