12345678910111213141516171819202122232425262728293031323334353637383940414243
#include<iostream> #include<string.h> using namespace std; int main() { int c,x,y,z; char b; string m,n,o; cin>>m; x=m.length(); for(y=0;y<=x;y++) { for(c=x;c==0;c--)//gets the place containing the highest { if(m[x]>=m[x-1]) { b=m[x]; z=x; } } for(c=0;c<=x;c++)//puts all the values except the highest one into n { if(c!=z) { n[c]=m[c]; } else { c--; } } m=n; cout<<o[y]; } cout<<"Here goes..."; cout<<o; return 0; }
if(c!=z)
12345
if(m[x]>=m[x-1]) { b=m[x]; z=x; }
123456789101112131415161718192021222324252627282930313233343536373839404142
#include<iostream> #include<string.h> using namespace std; int main() { int c(0),x(0),y(0),z(0); char b; string m,n,o; cin>>m; x=m.length(); for(y=0;y<=x;y++) { for(c=x;c==0;c--)//gets the place containing the highest { if(int(m[x])>=int(m[x-1])) { b=m[x]; z=x; } } for(c=0;c<=x;c++)//puts all the values except the highest one into n { if(c!=z) { n[c]=m[c]; } else { c--; } } m=n; } cout<<"Here goes..."; cout<<o; return 0; }
123
#include <algorithm> std::sort( str.begin(), std.end() );
12345678910111213
#include <iostream> #include <algorithm> #include <string> using namespace std; static bool ch_lti(char c1,char c2) {return tolower(c1)<tolower(c2);} int main() { string str; getline(cin,str); sort(str.begin(),str.end(),ch_lti); cout << str << endl; }