• 코드:
​x
 
1
#include <iostream>
2
#include <string>
3
using namespace std;
4
​
5
struct Name
6
{
7
    string first;
8
    string last;
9
};
10
​
11
struct Friends
12
{
13
    Name first_name;
14
    string address;
15
    string job;
16
};
17
​
18
int main(void)
19
{
20
    Friends hong = 
21
    {
22
        { "길동", "홍" },
23
        "서울시 강남구 역삼동",
24
        "학생"
25
    };
26
    
27
    cout << hong.address << endl << endl;
28
    cout << hong.first_name.last << hong.first_name.first << "에게," << endl;
29
    cout << "그동안 잘 지냈니? 아직도 " << hong.job << "이니?" << endl;
30
    cout << "다음에 꼭 한번 보자." << endl << "잘 지내.";
31
    return 0;
32
}
표준입력 & 실행옵션