Sort the letters of string in alphabetical order: Difference between revisions

Add C++
(Add C)
(Add C++)
Line 228:
<pre>Now is the time for all good men to come to the aid of their country.
.Naaccddeeeeeeffghhhiiiillmmmnnooooooooorrrstttttttuwy</pre>
 
=={{header|C++}}==
<lang cpp>#include <algorithm>
#include <iostream>
 
int main() {
std::string s = "Now is the time for all good men "
"to come to the aid of our country.";
std::cout << s << std::endl;
std::sort(s.begin(), s.end());
std::cout << s << std::endl;
return 0;
}</lang>
{{out}}
<pre>Now is the time for all good men to come to the aid of our country.
.Naaccddeeeeeffghhiiillmmmnnoooooooooorrrsttttttuuwy</pre>
 
=={{header|C#|CSharp}}==
2,114

edits