sorting string of numbersin c++ code example
Example: how to sort string containing numbers in c++
#include <iostream>
#include <bits/stdc++.h>
#include<string>
using namespace std;
int main() {
string s="4321";
int a[s.length()];
for(int i=0;i<s.length();i++){
a[i]=s[i]-48;
}
sort(a,a+s.length());
for(int i=0;i<s.length();i++){
cout<<a[i];
}
return 0;
}