Answers for "how to do the reverse order in c++"

C++
2

reverse() in c++

#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
    vector<int>a = {11,22,33,44,99,55};
    reverse(a.begin(), a.end());
    auto it = a.begin();
    for(it= a.begin(); it!=a.end(); it++){
        cout << *it << ' ';    
    }
}
Posted by: Guest on March-05-2021

Code answers related to "how to do the reverse order in c++"

Browse Popular Code Answers by Language