fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string s1 = "brick";
  9. string s2 = "block";
  10. string s;
  11.  
  12. s1.swap(s2);
  13. s2.swap(s);
  14. s.swap(s2);
  15. cout << s1;
  16. }
  17.  
  18.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
block