I have a bunch of strings that I need to sort. I think a std::vector would be the easiest way to do this. However, I\'ve never used vectors before and so would like some help.>
What is the question exactly? It seems everything is already there.
However, you should probably use std::cout << *i << std::endl;
i is an iterator == pointer to the data in the container, so * is neededc_str() is a function of std::string and not a variableThe problems in your code do not relate to your question?
Some hints for you:
std::vector also overrides [] operator, so you can instead save the iterator hassle and use it like an array (iterate from 0 to vector.size()).std::set instead, which has automatically sorting on insertion (binary tree), so you save the extra sorting.copy(V.begin(), V.end(), ostream_iterator(cout, "\n"));