Return to Snippet

Revision: 65587
at December 26, 2013 22:39 by Sadeveloper


Initial Code
// swap strings
#include <iostream>
#include <string>

main ()
{
  std::string buyer ("money");
  std::string seller ("goods");

  std::cout << "Before the swap, buyer has " << buyer;
  std::cout << " and seller has " << seller << '\n';

  seller.swap (buyer);

  std::cout << " After the swap, buyer has " << buyer;
  std::cout << " and seller has " << seller << '\n';

  return 0;
}

Initial URL
http://www.softafzar.net

Initial Description
Swap strings in C++

Initial Title
C++ swap strings

Initial Tags
c++

Initial Language
C++