10 std::cout <<
"\nMAP (1) DATA STRUCTURE" << std::endl;
12 std::map<std::string, std::pair<std::string, std::string>> students;
13 students.emplace(
"7890", std::pair{
"David",
"Tamaratare" });
14 students.emplace(
"7891", std::pair{
"David",
"Tamaralayefa"});
15 students.emplace(
"7892", std::pair{
"Daniel",
"Mark"});
17 std::cout <<
"The student with a MATRIC. NO. of 7890 is " << students[
"7890"].first <<
" " << students[
"7890"].second << std::endl;
21 std::cout <<
"\nMAP (2) DATA STRUCTURE" << std::endl;
23 std::map<std::string, std::list<std::string>> students;
24 students.emplace(
"7890", std::list<std::string>{
"David",
"Tamaratare",
"Oghenebrume"});
25 students.emplace(
"7891", std::list<std::string>{
"David",
"Tamaralayefa"});
26 students.emplace(
"7892", std::list<std::string>{
"David",
"Oghenebrume"});
28 for (
auto& student : students) {
29 std::cout <<
"The student with a MATRIC. NO. of " << student.first <<
" is ";
30 for (
auto& name : student.second) {
31 std::cout << name <<
" ";
33 std::cout << std::endl;