... initialize string
s first
and second
. Each string
is then output. Line 14 uses string
member function swap
to swap the values of first
and second
. The two string
s are printed again to confirm that they were indeed swapped. The string
member function swap
is useful for implementing programs that sort strings.
Get C++ How to Program, 10/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.