#include <map>
#include <iostream>
#include <vector>
#include <string>
int main()
{
//create a map
std::map<std::string, unsigned int> mySuperCoolMap;
mySuperCoolMap["Edward"] = 39;
mySuperCoolMap["Daniel"] = 35;
mySuperCoolMap["Carlos"] = 67;
mySuperCoolMap["Bobby"] = 8;
mySuperCoolMap["Alfred"] = 23;
std::cout << "\n\n";
//Ranged based for loop to display the names and age
for (auto itr : mySuperCoolMap)
{
std::cout << itr.first << " is: " << itr.second << " years old.\n";
}
//create another map
std::map<std::string, unsigned int> myOtherSuperCoolMap;
myOtherSuperCoolMap["Espana"] = 395;
myOtherSuperCoolMap["Dominic"] = 1000;
myOtherSuperCoolMap["Chalas"] = 167;
myOtherSuperCoolMap["Brian"] = 238;
myOtherSuperCoolMap["Angela"] = 2300;
//Display the names and age
for (auto itr : myOtherSuperCoolMap)
{
std::cout << itr.first << " is: " << itr.second << " years old.\n";
}
//create a vector of maps
std::vector<std::map<std::string, unsigned int>> myVectorOfMaps;
myVectorOfMaps.push_back(mySuperCoolMap);
myVectorOfMaps.push_back(myOtherSuperCoolMap);
std::cout << "\n\n";
//Display the values in the vector
for (auto vecitr : myVectorOfMaps)
{
for (auto mapitr : vecitr)
{
std::cout << mapitr.first << " is: " << mapitr.second << " years old.\n";
}
}
return 0;
}