본문 바로가기

Native/C++

map 사용 예

[code]
#include "stdafx.h"
#include <map>
#include <string>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    map<string,string> table;
    string s1 = "first";

    table["first"] = "Hello world";

    cout << table[s1] << endl; // 마치 php의 배열처럼 이용 가능하겠다.


    return 0;
}[/code]

'Native > C++' 카테고리의 다른 글

copyConstructor 복사생성자  (0) 2013.10.02
destructor  (0) 2013.10.02
& 연산자 (참조)  (0) 2013.10.02
static_cast<int>(변수)랑 (int)변수 dynamic_cast reinterpret_cast  (0) 2013.10.02
.net 에서 cout 이 안될때..  (0) 2013.10.02