Answers for "vector.rbegin()"

C++
0

vector.rbegin()

// CPP program to illustrate
// the vector::rbegin() function
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    vector<int> v;
    v.push_back(11);
    v.push_back(12);
    v.push_back(13);
    v.push_back(14);
    v.push_back(15);
 
    // prints all the elements
    cout << "The vector elements in reverse order are:\n";
    for (auto it = v.rbegin(); it != v.rend(); it++)
        cout << *it << " ";
    return 0;
}
Posted by: Guest on April-07-2022

Browse Popular Code Answers by Language