您当前的位置: 首页 >  c++
  • 0浏览

    0关注

    1477博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C++ multimap 用法总结 例子

软件工程小施同学 发布时间:2022-04-22 21:26:38 ,浏览量:0

#include   
#include   
#include   
using namespace std;  
  
int main()  
{  
    ///1. 初始化  
    multimap mapStudent;  
    multimap::iterator iter, beg, end;  
      
    ///2. 添加元素  
    ///multimap不支持下标操作  
    mapStudent.insert(pair(0, "student_one_1"));  
    mapStudent.insert(pair(0, "student_one_2"));///一对多 
	mapStudent.insert(pair(0, "student_one_3"));///一对多
    mapStudent.insert(pair(1, "student_two"));  
    mapStudent.insert(pair(5, "Fear Kubrick"));  
    mapStudent.insert(pair(2, "Akemi Homura"));  
    mapStudent.insert(pair(-1, "Eren Jaeger"));  
    mapStudent.insert(pair(99, "lin"));  
    cout             
关注
打赏
1665320866
查看更多评论
0.0401s