#include <iostream>
#include <vector>
#include <algorithm> //reverse算法用的到
using namespace std;
int main()
{
vector<int> v;
for (size_t i=0; i != 10; ++i)
{
v.push_back(i);
}
vector<int>::iterator it;
for (it=v.begin(); it!=v.end(); it++)
{
cout << *it << ' ';
}
cout << endl;
cin.get();
reverse(v.begin(),v.end());
for (it=v.begin(); it!=v.end(); it++)
{
cout << *it << ' ';
}
cout << endl;
cin.get();
return 0;
}
#include <vector>
#include <algorithm> //reverse算法用的到
using namespace std;
int main()
{
vector<int> v;
for (size_t i=0; i != 10; ++i)
{
v.push_back(i);
}
vector<int>::iterator it;
for (it=v.begin(); it!=v.end(); it++)
{
cout << *it << ' ';
}
cout << endl;
cin.get();
reverse(v.begin(),v.end());
for (it=v.begin(); it!=v.end(); it++)
{
cout << *it << ' ';
}
cout << endl;
cin.get();
return 0;
}