
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set Begin and Set End in C++ STL
Set::begin() function is a bidirectional iterator used to return an iterator pointing to the first element of the set container.
Set::end() function is a bidirectional iterator used to return an iterator pointing to the last element of the set container.
Example Code
#include<iostream> #include <bits/stdc++.h> using namespace std; int main() { set<int> s; set<int>::iterator it; s.insert(7); s.insert(6); s.insert(1); s.insert(4); s.insert(2); s.insert(9); s.insert(10); for (auto it=s.begin(); it != s.end(); ++it) cout << ' ' << *it; return 0; }
Output
1 2 4 6 7 9 10
Advertisements