No_name
1
#include
<
iostream
>
2 #include < map >
3 #include < vector >
4 #include < string >
5 #include < iomanip >
6
7 using namespace std;
8 enum PersonStyle {han_national,mongol_national,man_national,tibet,Sinkiang};
9 string CityType[] = { " 直辖市 " , " 省会 " , " 大城市 " };
10 string City[] = { " 上海 " , " 沈阳 " , " 石家庄 " , " 西宁 " , " 西安 " , " 厦门 " , " 南京 " , " 南宁 " , " 广州 " , " 北京 " };
11 typedef multimap < string , string > USERTABLE;
12 typedef USERTABLE::const_iterator CIT;
13 map < PersonStyle,USERTABLE > map_city;
14 typedef map < PersonStyle,USERTABLE > ::const_iterator PER;
15
16 int main()
17 {
18 USERTABLE m_user1;
19 m_user1.insert(make_pair( " 直辖市 " , " 上海 " ));
20 m_user1.insert(make_pair( " 直辖市 " , " 北京 " ));
21 m_user1.insert(make_pair( " 直辖市 " , " 广州 " ));
22
23 map_city.insert(make_pair(han_national,m_user1));
24
25 USERTABLE m_user2;
26 m_user2.insert(make_pair( " 省会 " , " 沈阳 " ));
27 m_user2.insert(make_pair( " 省会 " , " 西宁 " ));
28 m_user2.insert(make_pair( " 省会 " , " 南京 " ));
29
30 map_city.insert(make_pair(mongol_national,m_user2));
31
32
33 for (PER it_per = map_city.begin();it_per != map_city.end();it_per ++ )
34 {
35 cout << " 少数民族 " << it_per -> first << " 所在的城市为: " << endl;
36 for (CIT it_cit = (it_per -> second).begin();it_cit != (it_per -> second).end();it_cit ++ )
37 {
38 cout << setw( 8 ) << " 城市类型: " << it_cit -> first << endl;
39 cout << setw( 8 ) << " 城市: " << it_cit -> second << endl;
40 }
41 }
42 system( " pause " );
43 return 0 ;
44 }
45
46
47
2 #include < map >
3 #include < vector >
4 #include < string >
5 #include < iomanip >
6
7 using namespace std;
8 enum PersonStyle {han_national,mongol_national,man_national,tibet,Sinkiang};
9 string CityType[] = { " 直辖市 " , " 省会 " , " 大城市 " };
10 string City[] = { " 上海 " , " 沈阳 " , " 石家庄 " , " 西宁 " , " 西安 " , " 厦门 " , " 南京 " , " 南宁 " , " 广州 " , " 北京 " };
11 typedef multimap < string , string > USERTABLE;
12 typedef USERTABLE::const_iterator CIT;
13 map < PersonStyle,USERTABLE > map_city;
14 typedef map < PersonStyle,USERTABLE > ::const_iterator PER;
15
16 int main()
17 {
18 USERTABLE m_user1;
19 m_user1.insert(make_pair( " 直辖市 " , " 上海 " ));
20 m_user1.insert(make_pair( " 直辖市 " , " 北京 " ));
21 m_user1.insert(make_pair( " 直辖市 " , " 广州 " ));
22
23 map_city.insert(make_pair(han_national,m_user1));
24
25 USERTABLE m_user2;
26 m_user2.insert(make_pair( " 省会 " , " 沈阳 " ));
27 m_user2.insert(make_pair( " 省会 " , " 西宁 " ));
28 m_user2.insert(make_pair( " 省会 " , " 南京 " ));
29
30 map_city.insert(make_pair(mongol_national,m_user2));
31
32
33 for (PER it_per = map_city.begin();it_per != map_city.end();it_per ++ )
34 {
35 cout << " 少数民族 " << it_per -> first << " 所在的城市为: " << endl;
36 for (CIT it_cit = (it_per -> second).begin();it_cit != (it_per -> second).end();it_cit ++ )
37 {
38 cout << setw( 8 ) << " 城市类型: " << it_cit -> first << endl;
39 cout << setw( 8 ) << " 城市: " << it_cit -> second << endl;
40 }
41 }
42 system( " pause " );
43 return 0 ;
44 }
45
46
47