// reverse_copy example
#include <iostream>     // cout
#include <algorithm>    // reverse_copy
#include <vector>       // vector
using namespace std;
int main () {
  int myints[] ={1,2,3,4,5,6,7,8,9};
  vector<int> myvector;

  myvector.resize(9);    // allocate space

  reverse_copy (myints, myints+9, myvector.begin());

  // print out content:
  cout << "myvector contains:";
  for (vector<int>::iterator it=myvector.begin(); it!=myvector.end(); ++it)
    cout << ' ' << *it;

  cout << '\n';

  return 0;
}

 

相关文章:

  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2021-09-11
猜你喜欢
  • 2021-11-15
  • 2021-07-20
  • 2022-12-23
  • 2021-10-08
  • 2022-02-24
  • 2022-12-23
  • 2022-02-19
相关资源
相似解决方案