Answers for "sort every word in string s c++"

C++
9

how to sort a string in c++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	srting str; // First, declare a string.
  	sort(str.begin() , str.end()); // Then sort it by using this method. It is much more convenient.
  	cout << str << endl; // Last of all, print out the string.
}
Posted by: Guest on May-26-2021
0

how to sort a string alphabetically in c++

#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
sort(s.begin(),s.end());
cout<<s<<endl;
}
Posted by: Guest on February-09-2022

Browse Popular Code Answers by Language