vector.begin, vector.end returns the iterators
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
const int VECTOR_SIZE = 8 ;
typedef vector<int> IntVector ;
typedef IntVector::iterator IntVectorIt ;
IntVector Numbers(VECTOR_SIZE) ;
IntVectorIt start, end, it ;
Numbers[0] = 4;
Numbers[1] = 1;
Numbers[2] = 7;
Numbers[3] = 3;
Numbers[4] = 1;
Numbers[5] = 6;
Numbers[6] = 9;
Numbers[7] = 10;
start = Numbers.begin() ;
end = Numbers.end() ;
for(it = start; it != end; it++)
cout << *it << " " ;
random_shuffle(start, end) ;
for(it = start; it != end; it++)
cout << *it << " " ;
}
Related examples in the same category