fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void sort(int a, int b) {
  5. int mask = ((b - a) & ((b - a) >> 31));
  6. a += mask;
  7. b -= mask;
  8. cout << a << ", " << b << endl;
  9. }
  10.  
  11.  
  12. int main() {
  13.  
  14. sort(1, 2);
  15. sort(2, 1);
  16. sort(-1, -2);
  17. sort(-2, -1);
  18.  
  19. // your code goes here
  20. return 0;
  21. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1, 2
1, 2
-2, -1
-2, -1