Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- int n;
- char *aux;
- cout<<"Cate nume se citesc?"; cin>>n;
- char cuv[n][20];
- for (int i=0; i<n; i++)
- cin>>cuv[i];
- int ok;
- do{
- ok=0;
- for (int i=0; i<n-1; i++){
- if (strcmp(cuv[i], cuv[i+1])<0){
- strcpy(aux,cuv[i]);
- strcpy(cuv[i],cuv[i+1]);
- strcpy(cuv[i+1],aux);
- ok=1;
- }
- }
- }while(ok);
- cout<<endl<<endl;
- for (int i=n; i>=0; i++){
- cout<<cuv[i]<<" ";
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement