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("cuvinte.in.cpp");
- char c[1001][21],aux[21];
- int main()
- {
- int i,j,n;
- fin>>n;
- for(i=1;i<=n;i++) fin>>c[i];
- for(i=1;i<=n;i++)
- {
- for(j=i+1;j<=n;j++)
- {
- if(strlen(c[i])>strlen(c[i+1]))
- {
- strcpy(aux,c[i]);
- strcpy(c[i],c[i+1]);
- strcpy(c[i+1],aux);
- }
- }
- }
- for(i=1;i<=n;i++)
- {
- cout<<c;
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement