fig19_04.cpp

来自「经典vc教程的例子程序」· C++ 代码 · 共 18 行

CPP
18
字号
// Fig. 19.4: fig19_04.cpp
// Using the swap function to swap two strings
#include <iostream>
#include <string>
using namespace std;

int main()
{
   string first( "one" ), second( "two" );

   cout << "Before swap:\n first: " << first
        << "\nsecond: " << second;
   first.swap( second );
   cout << "\n\nAfter swap:\n first: " << first
        << "\nsecond: " << second << endl;
    
   return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?