+ 28

How to alphabetically sort a string with uppercase and lowercase characters?

This is what I have, so far. #include <iostream> #include <algorithm> using namespace std; int main() { string str="zXxybac"; sort(str.begin(), str.end()); cout<<str; return 0; } Output: Xabcxyz ___________________ what I want is to arrange the 'X' after 'x'.

12th Mar 2017, 11:55 AM
Jobelle
Jobelle - avatar
1 Odpowiedź
+ 14
u can check my code if it helps u alfa sorting
12th Mar 2017, 5:21 PM
Mansi Dagla
Mansi Dagla - avatar