SHARE
TWEET

Untitled

a guest Mar 4th, 2013 104 Never
  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;
RAW Paste Data
Top