Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4. #include <fstream>
  5. using namespace std;
  6. ifstream fin("sortcuv.in");
  7. ofstream fout("sortcuv.out");
  8. int main()
  9. {
  10. string s[201],x;
  11. int n=0;
  12. while(fin>>x)
  13. s[++n]=x;
  14. for(int i=1;i<n;i++)
  15. {
  16. for(int j=i+1;j<=n;j++)
  17. if(s[i]>s[j])
  18. swap(s[i],s[j]);
  19.  
  20. }
  21. for(int i=1;i<=n;i++)
  22. fout<<s[i]<<endl;
  23.  
  24.  
  25. fin.close();
  26. fout.close();
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement