Advertisement
SelinD

80

Jun 28th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstring>
  3. #include<fstream>
  4. using namespace std;
  5. ifstream fin("cuv.txt.cpp");
  6.  
  7. void ordonare(char c1[31],char c2[31],char c3[31])
  8. {
  9. char aux[31];
  10.  
  11. if(strcmp(c1,c2)>0)
  12. {
  13. strcpy(aux,c1);
  14. strcpy(c1,c2);
  15. strcpy(c2,aux);
  16. }
  17. if(strcmp(c2,c3)>0)
  18. {
  19. strcpy(aux,c2);
  20. strcpy(c2,c3);
  21. strcpy(c3,aux);
  22. }
  23. if(strcmp(c1,c2)>0)
  24. {
  25. strcpy(aux,c1);
  26. strcpy(c1,c2);
  27. strcpy(c2,aux);
  28. }
  29. }
  30.  
  31. int main()
  32. {
  33. char c1[30],c2[30],c3[30];
  34. while(fin>>c1>>c2>>c3)
  35. {
  36. ordonare(c1,c2,c3);
  37. cout<<c1<<" "<<c2<<" "<<c3;
  38. cout<<endl;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement