본문 바로가기
C++/0x07-stl

map

by SpeeDr00t 2016. 7. 11.
반응형

map 사용하기

#include<iostream>
#include<map>
#include<string>
using namespace std;


int main()
{

    map<string,float> testMap;

    testMap["AB"]=0.1;
    testMap["CD"]=0.2;
    testMap["EF"]=0.3;

    map<string,float>::iterator it;

    for( it = testMap.begin() ; it != testMap.end() ; it++ ){

        cout <<"key : " << it->first << " , "  <<"value : " << it->second << endl;
    }
}




반응형

'C++ > 0x07-stl' 카테고리의 다른 글

find  (0) 2016.07.12
pair  (0) 2016.07.12
set  (0) 2016.07.10
list  (0) 2016.07.10
deque  (0) 2016.07.10