top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Program to all map values in c++?

0 votes
475 views

I want to get all the map values in c++? Please share sample code?

posted Feb 19, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
myMap.insert(make_pair(first_name, make_pair(middle_name, last_name)));
for(map<string, pair<string,string> >::const_iterator it = myMap.begin();
    it != myMap.end(); ++it)
{
    std::cout << it->first << " " << it->second.first << " " << it->second.second << "\n";
}
answer Feb 19, 2016 by Rajan Paswan
0 votes
for(map<string, pair<string,string> >::const_iterator it = myMap.begin();
    it != myMap.end(); ++it)
{
    std::cout << it->first << " " << it->second.first << " " << it->second.second << "\n";
}
answer Feb 20, 2016 by Gunjan Saraswat
...