Sort doesn't sort strings alphabetically?

1
2
3
4
5
6
        vector<string> pString = {"hi", "hii", "bye", "alakamaz!", "o"};

        printV(pString);
        sort(pString.begin(), pString.end());
        printV(pString);


This outputs:

hi
hii
bye
alakamaz!
o

alakamaz!
bye
hi
hii
o

Sorting only the first letter and not the whole string.

Everywhere I look online claims that sort should sort strings alphabetically. What's the beef?

What is the problem here? They are sorted alphabetically.
ohhh

I had been thinking all this time that shorter strings have to be before longer strings when you sort words alphabetically.

Well, problem solved haha. Thanks lol
Last edited on
Topic archived. No new replies allowed.