You could always try this syntax:
vector<int> sample_array(10);
if you want a vector of ints with space for exactly 10 ints and don't want to call resize().
If you find that the stuff you do in fill() and sort() aren't maintained in the vector in the calling function, then you will need to pass the vector by reference explicitly instead of the automatic pass by reference that happens when you pass arrays.
Oh, and to use the STL vector class you'll need to include the vector header file; and I'd move the using namespace std; line to have global scope rather than function scope so you don't have to type it twice (or more often).
Last edited by Lerner; May 16th, 2007 at 5:40 pm.
Reputation Points: 718
Solved Threads: 373
Nearly a Posting Maven
Offline 2,253 posts
since Jul 2005