fork download
  1. #include <tuple>
  2. #include <utility>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int x1 = 10, x2=20, y1=132, y2=12, minx, miny, maxx, maxy;
  10.  
  11. tie(minx, maxx) = (x1 <= x2)? make_pair(x1, x2) : make_pair(x2, x1);
  12. tie(miny, maxy) = (y1 <= y2)? make_pair(y1, y2) : make_pair(y2, y1);
  13.  
  14. cout<<"minx="<<minx<<"\n";
  15. cout<<"maxx="<<maxx<<"\n";
  16. cout<<"miny="<<miny<<"\n";
  17. cout<<"maxy="<<maxy<<"\n";
  18. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
minx=10
maxx=20
miny=12
maxy=132