Advertisement
Guest User

Untitled

a guest
Sep 13th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <cstdio>
  2. #include <algorithm>
  3. #include <string>
  4. using namespace std;
  5.  
  6. bool cmp(const string& a, const string& b) {
  7.     return lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
  8. }
  9.  
  10. int main() {
  11.     string arr[10] =  { "bnenhMxiK", "eaQrds", "fRNwNn", "inOCWEZHxy", "jA", "kyRNTE", "PIZRMOu", "XtueKFM", "yA", "zlkOe" };
  12.     sort(arr, arr + 10, cmp);
  13.     for (int i = 0; i < 10; ++i) {
  14.         puts(arr[i].data());
  15.     }
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement