Stick it between where you generate the list and where you print it.
(
AbstractionAnon made a typo: it should be
std::osrt(list.begin(), list.end());
.)
However,
don't do that.
(Unless, of course, your assignment specifically asks you to output the strings in alphabetical order.)
A few notes
output should not be a global object. Make it local just like
input.
You never use the filenames outside of opening the files. You can make your code simpler and shorter with just:
13 14 15 16 17 18
|
int main(int argc, char* argv[])
{
ArgumentManager am(argc, argv);
ifstream input(am.get("input"));
ofstream output(am.get("output"));
|
You should be returning zero from main. Non-zero values indicate that something went wrong.
If you are allowed, you can also get rid of that global
list by making it a reference argument to
permute. Then you can use it as a local variable as well (local to
main). For now, though, don't worry about that stuff.
Also, people will give you grief about
using namespace std. There are only a few places that is really ever reasonable. You should make it a habit now, early, to be clear about what namespace you are pulling things from:
1 2 3 4
|
std::vector<std::string> list;
std::ifstream input(am.get("input"));
std::string str;
std::sort(list.begin(), list.end());
|
Then you can get rid of the 'evil' using namespace std clause.
Nicely done on the permutation!
Hope this helps.