This will print out the key and value of each element inside the map. And since map is sorted, the printing order will also be sorted according to the key.
Your task is to use the range-based for loop to print out each element in a line in the power_level map. The format is:
<name>'s power level is <power>
#include <map>
#include <iostream>
#include <string>
int main()
{
// Create the map power_level
std::map<std::string, int> power_level{
{"Raditz", 1500},
{"Nappa", 4000},
{"Goku", 9000},
{"Vegeta", 18000},
{"Piccolo", 3500},
{"Krillin", 1770},
{"Yamcha", 1480},
{"TienShinhan", 1830},
{"Chiaotzu", 610},
{"Yajirobe", 970},
{"Gohan", 2800},
{"Saibamen", 1200},
};
// Write your code after this line!
}
#include <map>
#include <iostream>
#include <string>
int main()
{
// Create the map power_level
std::map<std::string, int> power_level{
{"Raditz", 1500},
{"Nappa", 4000},
{"Goku", 9000},
{"Vegeta", 18000},
{"Piccolo", 3500},
{"Krillin", 1770},
{"Yamcha", 1480},
{"TienShinhan", 1830},
{"Chiaotzu", 610},
{"Yajirobe", 970},
{"Gohan", 2800},
{"Saibamen", 1200},
};
// Write your code after this line!
}