I created two maps one initialized to be map<string,int>msi and the other to be map<int,string>mis, im having difficulties copying the contents of the msi map to the mis map, and also how would i find a better way of adding the intergers of map msi while using the map.
> I created two maps one initialized to be map<string,int>msi and the other to be map<int,string>mis,
> im having difficulties copying the contents of the msi map to the mis map
What do you mean by 'copying the contents of the msi map to the mis map'?
In a map<string,int>, the keys (string) are unique, the mapped data values (int) are not.
In the other map the int values (keys) are unique, the string values (mapped data) are not.
> how would i find a better way of adding the intergers of map msi while using the map.
Iterate though the map, accumulating the values as you go along. Something like:
1 2 3 4
std::map<std::string,int> msi ;
// populate the map
int sum = 0 ;
for( constauto& pair : msi ) sum += pair.second ;