How to alphabetically sort a string with uppercase and lowercase characters? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
+ 14
u can check my code if it helps u alfa sorting
12th Mar 2017, 5:21 PM
Mansi Dagla
Mansi Dagla - avatar