Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void sortuj(string &d)
- {
- int n=d.size();
- for(int j=0;j<n-1;j++)
- for(int i=0;i<n-1-j;i++)
- if(d[i]>d[i+1])
- swap(d[i], d[i+1]);
- }
- int main()
- {
- string d;
- cout<<"Podaj elementy do posortowania: "<<endl;
- cin>>d;
- sortuj(d);
- cout<<d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement