Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<cstring>
- using namespace std;
- ifstream fin("x.in");
- void ordonare (char c1[100], char c2[100], char c3[100])
- {
- char aux[100];
- if (strcmp (c1, c2)>0)
- {
- strcpy (aux, c1);
- strcpy (c1, c2);
- strcpy(c2,aux);
- }
- if (strcmp (c2, c3)>0)
- {
- strcpy (aux, c2);
- strcpy (c2, c3);
- strcpy(c3,aux);
- }
- if (strcmp (c1, c2)>0)
- {
- strcpy (aux, c1);
- strcpy (c1, c2);
- strcpy(c2,aux);
- }
- }
- char a[100], b[100], c[100];
- int main ()
- {
- while (fin>>a>>b>>c)
- {
- ordonare(a,b,c);
- cout<<a<<" "<<b<<" "<<c;
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment