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 ("inlocuirecuvant.in");
- ofstream fout ("inlocuirecuvant.out");
- int main()
- {
- int i=0,c,j=0;
- string s[250],s2[250],x,aux;
- while (fin >> x)
- {
- s[++i]=x;
- if (x[0]>='A' && x[0] <='Z')
- x[0]-=32;
- s2[i]=x;
- }
- c=i;
- for (i=1 ; i<c ; i++)
- for (j=i+1 ; j<=c ; j++)
- if (s2[i]>s2[j])
- {
- aux=s2[i];
- s2[i]=s2[j];
- s2[j]=aux;
- aux=s[i];
- s[i]=s[j];
- s[j]=aux;
- }
- for (i=1; i<=c ;i++)
- fout << s[i] << " " << endl;
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement