Reputation: 1
There will be a given input by the user and I have to put it into alphabetical order with the uppercase characters in the front, lowercase after. C++ For example, the input is GoodMorning, the output will be GMdginnooor.
Upvotes: 0
Views: 38
Reputation: 7726
It's pretty simple, just use the following:
#include <iostream>
#include <algorithm>
int main(void)
{
std::string text;
std::cout << "Input a string: ";
getline(std::cin, text);
std::sort(text.begin(), text.end());
std::cout << text;
return 0;
}
Sample Output
Input a string: GoodMorning
GMdginnooor
Hope it helps you!
Upvotes: 1