fork download
  1. #include <iostream>
  2. #include<algorithm>
  3. #include<vector>
  4. using namespace std;
  5.  
  6. vector<int>v1;
  7.  
  8. bool cmp(int a, int b)
  9. {
  10. return (a>b);
  11. }
  12.  
  13. int main() {
  14. // your code goes here
  15. v1.push_back(3);
  16. v1.push_back(1);
  17. v1.push_back(7);
  18. sort(v1.begin(), v1.end(),cmp);
  19. for(int i=0; i<(int)v1.size(); i++)
  20. cout<<v1[i]<<" ";
  21. return 0;
  22. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
7 3 1