1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
// 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;
}
|