If you want to use STL it can be done like this -
Code:
#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<string> mystrings(3);
mystrings[0] = "cccc";
mystrings[1] = "bbbb";
mystrings[2] = "aaaa";
sort(mystrings.begin(),mystrings.end());
for (int i=0;i<3;i++)
cout << mystrings[i] << endl;
return 0;
}
If you want to do with quicksort, I don't know why a strcmp type function wouldn't work. Perhaps you could post some code.
I'm not sure what you mean by your second queston. Are you trying to sort the strings according to where they should be outputted in the file? If so you could map a number to each string a sort the strings by this number.