fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int x=54;
  7. int y=12;
  8.  
  9. int pom;
  10. pom=x; //zapamietuje wartosc x
  11. x=y; // x przyjmuje wartosc y
  12. y=pom; // y przyjmuje wartosc poczatkowa x
  13.  
  14. cout << x << " " << y << endl;
  15. swap(x,y);
  16. cout << x << " " << y << endl;
  17.  
  18.  
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
12 54
54 12