how to create a vector of maps and how to store values in it and how to print those values??
vector< map< string, int > > v;
for( int i = 0; i < 5; ++i )
{
map< string, int > temp;
temp.insert( make_pair( β1β, i );
temp.insert( make_pair( β2β, i );
v.emplace_back( temp );
}
foreach( auto& a : v )
{
foreach( auto& m : a )
{
cout << "key : " << a.first << " value : " << a.second << β\nβ;
}
cout << βnext\nβ;
}
you did not mention what language, so I made it in C++
1 Like