Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstring>
- #include<fstream>
- using namespace std;
- ifstream fin("cuv.txt.cpp");
- void ordonare(char c1[31],char c2[31],char c3[31])
- {
- char aux[31];
- 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);
- }
- }
- int main()
- {
- char c1[30],c2[30],c3[30];
- while(fin>>c1>>c2>>c3)
- {
- ordonare(c1,c2,c3);
- cout<<c1<<" "<<c2<<" "<<c3;
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement