Why reinvent a wheel? Especially since your wheel is square, and the free one's are generally round...

Code:

vector<int> vec;
// insert some integers
copy(istream_iterator<int>(cin), istream_iterator(), back_inserter(vec));
// sort them (worst case: N*N, best case: N*log(N)
sort(vec.begin(), vec.end());
// Or:
// sort(vec.begin(), vec.end(), greater<int>());
// Or:
// sort(vec.begin(), vec.end(), less<int>());
// Or
// "N*log(N)*log(N) algo that improves toward N*log(N) when
// the system has sufficient memory" - Stroustrup
// stable_sort(vec.begin(), vec.end());
// display results
copy(vec.begin(), vec.end(), ostream_iterator<int>(cout));