Search
 
SCRIPT & CODE EXAMPLE
 

CPP

vector library c++

// C++ program to illustrate the
// iterators in vector
#include <iostream>
#include <vector>
  
using namespace std;
  
int main()
{
    vector<int> g1;
  
    for (int i = 1; i <= 5; i++)
        g1.push_back(i);
  
    cout << "Output of begin and end: ";
    for (auto i = g1.begin(); i != g1.end(); ++i)
        cout << *i << " ";
  
    cout << "
Output of cbegin and cend: ";
    for (auto i = g1.cbegin(); i != g1.cend(); ++i)
        cout << *i << " ";
  
    cout << "
Output of rbegin and rend: ";
    for (auto ir = g1.rbegin(); ir != g1.rend(); ++ir)
        cout << *ir << " ";
  
    cout << "
Output of crbegin and crend : ";
    for (auto ir = g1.crbegin(); ir != g1.crend(); ++ir)
        cout << *ir << " ";
  
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: inserting element in vector in C++ 
Cpp :: check if a key is in map c++ 
Cpp :: binary search in c++ 
Cpp :: cin exceptions c++ 
Cpp :: c++ #define 
Cpp :: how to generate number in c++ 
Cpp :: how to remove maximum number of characters in c++ cin,ignore 
Cpp :: Function to calculate compound interest in C++ 
Cpp :: factorial of large number 
Cpp :: how to use a non const function from a const function 
Cpp :: Subarray with given sum in c++ 
Cpp :: convert all strings in vector to lowercase or uppercase c++ 
Cpp :: search by value in map in stl/cpp 
Cpp :: dice combinations cses solution 
Cpp :: C++ sum a vector of digits 
Cpp :: linux c++ sigint handler 
Cpp :: how to empty a std vector 
Cpp :: sum of first 100 natural numbers 
Cpp :: c++ class 
Cpp :: how to traverse through vector pair 
Cpp :: balanced parentheses 
Cpp :: print elements of linked list 
Cpp :: how to declare an enum variable c++ 
Cpp :: statements 
Cpp :: int to string C++ Using stringstream class 
Cpp :: C++ vector structure 
Cpp :: copy vector c++ 
Cpp :: A Program to check if strings are rotations of each other or not 
Cpp :: bubble sort function in c++ 
Cpp :: c++ bit shift wrap 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =