fork download
  1. #include <vector>
  2. #include <algorithm>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. vector<pair<string, string>> v{{"b", "d"}, {"d", "g"}, {"a", "z"}};
  9. sort(v.begin(), v.end());
  10.  
  11. for (auto x : v) cout << x.first << " " << x.second << endl;
  12. }
  13.  
Success #stdin #stdout 0.01s 5484KB
stdin
Standard input is empty
stdout
a z
b d
d g