Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 4th, 2013  |  syntax: C++  |  size: 0.33 KB  |  views: 55  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         int vals[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
  2.         vector<int> numbers(vals, vals + 10);
  3.  
  4.         vector<int>::iterator       start = numbers.begin();
  5.         vector<int>::reverse_iterator end = numbers.rbegin();
  6.        
  7.         while (start != end.base() && start != (end + 1).base())
  8.                 swap(*(start++), *end++);
  9.  
  10.         for (int i : numbers)
  11.                 cout << i << endl;