• 코드:
​x
 
1
#include <iostream>
2
#include <string>
3
using namespace std;
4
​
5
int main(void)
6
{
7
    string str1 = "C++ is ";
8
    string str2 = "Cool! and funny!";
9
    string str3;
10
    
11
    str3 = str1 + str2;     // 문자열 결합 연산    
12
    cout << str3 << endl;
13
    str1 += str2;           // 문자열 추가 연산 
14
    cout << str1;
15
    return 0;
16
}
표준입력 & 실행옵션