代码语言:javascript复制
#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
#include<ctime>
void p(int val)
{
cout << val << " ";
}
void test01()
{
vector<int> v = { 1,2,3,4,5,6,7,8,9 };
reverse(v.begin(), v.end()-6);
for_each(v.begin(), v.end(), p);
}
int main()
{
srand((size_t)time(NULL));
test01();
cout << endl;
system("pause");
return 0;
}