[Solved] Counting Occurrences of integers in map c++ [closed]


Use map::find

int keyToInsert = 2;

std::map<int, int>::iterator it;
it = yourMap.find(key);
if(it != yourMap.end()){
    //alert user key exists
}
else {
    //key doesn't exist
}

See docs: http://www.cplusplus.com/reference/map/map/find/

1

solved Counting Occurrences of integers in map c++ [closed]