Advertisement
bogolyubskiyalexey

Untitled

Jan 15th, 2021
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cctype>
  4. #include <algorithm>
  5.  
  6.  
  7.  
  8.  
  9.  
  10. bool cmp(const std::vector<int> a, const std::vector<int> b) {
  11.     size_t i = 0;
  12.     while (i < a.size() && i < b.size()) {
  13.         if (a[i] != b[i]) {
  14.             return (a[i] < b[i]);
  15.         }
  16.         ++i;
  17.     }
  18.     if (i < a.size()) {
  19.         return false;
  20.     }
  21.     if (i < b.size()) {
  22.         return true;
  23.     }
  24.     return false;
  25. }
  26.  
  27. int main() {
  28.     std::vector<std::string> a;
  29.     a.push_back("abcd");
  30.     a.push_back("Addf");
  31.     a.push_back("zasdfaaa");
  32.     a.push_back("a");
  33.  
  34.     std::sort(a.begin(), a.end());
  35.     for (auto s : a) {
  36.         std::cout << s << std::endl;
  37.     }
  38.     std::cout << uint32_t('A') << " " << uint32_t('a') ;
  39.  
  40.     std::sort(a.rbegin(), a.rend());
  41.     for (auto s : a) {
  42.         std::cout << s << std::endl;
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement