Horje
vector library c++ Code Example
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 << "\nOutput of cbegin and cend: ";
    for (auto i = g1.cbegin(); i != g1.cend(); ++i)
        cout << *i << " ";
  
    cout << "\nOutput of rbegin and rend: ";
    for (auto ir = g1.rbegin(); ir != g1.rend(); ++ir)
        cout << *ir << " ";
  
    cout << "\nOutput of crbegin and crend : ";
    for (auto ir = g1.crbegin(); ir != g1.crend(); ++ir)
        cout << *ir << " ";
  
    return 0;
}




Cpp

Related
Compute Average Code Example Compute Average Code Example
C++ Third angle of a Triangle Code Example C++ Third angle of a Triangle Code Example
how to fix class friendship errors in c++ Code Example how to fix class friendship errors in c++ Code Example
what are various sections of process Code Example what are various sections of process Code Example
how to create a copy constructor for generic array class in c++ Code Example how to create a copy constructor for generic array class in c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11