SHARE
TWEET

Untitled

a guest Jul 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10. #include <string>
  11. #include <algorithm>
  12. using namespace std;
  13.  
  14. int main()
  15. {
  16.     int z = 0;
  17.     string name[3];
  18.     cout<<"Enter 10 words: \n";
  19.     for (int x = 0; x<3; x++){
  20.         cin>>name[x];
  21.     }
  22.     sort(begin(name),end(name));
  23.     cout<<"Ascending ";
  24.     for(auto n: name){
  25.          cout << n << endl;
  26.     }
  27.    
  28.     reverse(begin(name),end(name));
  29.     cout<<"Descending ";
  30.     for(auto n: name){
  31.          cout << n << endl;
  32.     }
  33.    
  34.     return 0;    
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top