#include<bits/stdc++.h>
using namespace std;
vector<int> v(,); 定义一个大小为9,初始化全是1的vector数组
set<int> s;
queue<int> q;
int main()
{
for(auto i:v) // 遍历vector
printf("%d ",i);
v.push_back();插入一个数据
printf("\n%d", v[]);
v.clear();清除vector数组
printf("\n%d",v.size());
s.insert();向set中插入数据
s.insert();
s.insert();
printf("\n%d\n", s.size());
for(auto i:s)
printf("%d ",i);
q.push();// 添加元素
q.pop(); // 删除第一个元素
q.front(); // 显示第一个元素
}

注意:vector<pair(int,int)> v;

放入元素:v.push_back(make_pair(a,b))

取元素:v[i].first,v[i].second.

vector, map, queue,set常用总结的更多相关文章

  1. C++关于vector、queue、stack、priority_queue的元素访问

    vector.queue.stack.priority_queue对元素进行元素访问时,返回的是对应元素的引用.

  2. Java中的容器类(List,Set,Map,Queue)

    Java中的容器类(List,Set,Map,Queue) 一.基本概念 Java容器类类库的用途是“保存对象”,并将其划分为两个不同的概念: 1)Collection.一个独立元素的序列,这些元素都 ...

  3. hdoj--5233--Gunner II(map+queue&&二分)

     Gunner II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Tot ...

  4. STL容器用法速查表:list,vector,stack,queue,deque,priority_queue,set,map

      list vector deque stack queue priority_queue set [unordered_set] map [unordered_map] multimap [uno ...

  5. c++ list, vector, map, set 区别与用法比较

    http://blog.csdn.net/alex_xhl/article/details/37692297 List封装了链表,Vector封装了数组, list和vector得最主要的区别在于ve ...

  6. list, vector, map, set 区别与用法比较

    List封装了链表,Vector封装了数组, list和vector得最主要的区别在于vector使用连续内存存储的,他支持[]运算符,而list是以链表形式实现的,不支持[]. Vector对于随机 ...

  7. java三篇博客转载 详解-vector,stack,queue,deque

    博客一:转载自http://shmilyaw-hotmail-com.iteye.com/blog/1825171 java stack的详细实现分析 简介 我们最常用的数据结构之一大概就是stack ...

  8. uva 11991 Easy Problem from Rujia Liu? vector+map

    水题 学习一下数据的存储方法. #include<iostream> #include<cstdio> #include<cstdlib> #include< ...

  9. 使用linux的GDB打印STL(vector,map,set..................)

    在linux用gdb或者cgdb计较不爽的地方是无法打印STL的东西,所有啊去网上找了找解决方案https://www.douban.com/note/182826844/?qq-pf-to=pcqq ...

随机推荐

  1. 【转载】c++指针的指针和指针的引用

    https://www.cnblogs.com/li-peng/p/4116349.html

  2. SpringBoot(七):SpringBoot整合Swagger2

    原文地址:https://blog.csdn.net/saytime/article/details/74937664 手写Api文档的几个痛点: 文档需要更新的时候,需要再次发送一份给前端,也就是文 ...

  3. How to learn PDE (怎么学偏微分方程)

    To learn PDE, you need some knowledge of physics (to build up the intuition), solid training of anal ...

  4. 2.12 for循环

    for循环 像while循环一样,for可以完成循环的功能. 在Python中 for循环可以遍历任何序列的项目,如一个列表或者一个字符串等. for循环的格式 for 临时变量 in 列表或者字符串 ...

  5. word2vec概述

    既然是概述,那么我也只会在文中谈一点关于 Word2Vec 的思想和大概的方法.对于这个算法,如果一开始学习就深入到算法细节中,反而会陷入局部极值点,最后甚至不知道这个算法是干嘛的.在了解算法大概的思 ...

  6. ActiveMQ简单介绍及安装

    消息中间件 我们简单的介绍一下消息中间件,对它有一个基本认识就好,消息中间件(MOM:Message Orient middleware). 消息中间件有很多的用途和优点: 1. 将数据从一个应用程序 ...

  7. JDBC连接MariaDB:数据传输加密

    环境:win7+springboot+mybatis+mariadb 需求说明: 未做安全加固前用wireshark抓包: 可以很明显看到用户名.数据库和 SQL,这种情况是有安全风险的. 1.下载o ...

  8. POST 请求中 multipart/form-data、 application/x-www-form-urlencoded 的区别

    以 Postman 为工具来看一下这两个编码类型的数据格式,假设我们需要传输的数据为 { "name": "test", "age": 18 ...

  9. mysql修改字符集

    文章链接:https://www.cnblogs.com/hubavyn/p/4359315.html mysql修改表.字段.库的字符集(转) 原文链接:http://fatkun.com/2011 ...

  10. js-分享功能插件

    soshm 分享功能插件 地市:https://github.com/calledT/soshm yarn 安装:yarn add soshm -s;  引入:import soshm from ‘s ...