fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // Input
  6. int a, b;
  7. cin >> a >> b;
  8.  
  9. // Process
  10. int tmp = a;
  11. a = b;
  12. b = tmp;
  13.  
  14. // Output
  15. cout << "after swapping a = " << a << ", b = " << b;
  16. }
Success #stdin #stdout 0.01s 5316KB
stdin
1 2
stdout
after swapping a = 2, b = 1