1. 程式人生 > >[精華版STL]

[精華版STL]

//STL 資料結構
#include<queue>//佇列,堆
#include<stack>//棧
#include<map>//map
#include<string>
using namespace std;
queue<int> que;//佇列
stack<int> sta;//棧
priority_queue<int>heap;//堆
map<int,int>ma;//map
map<int, map<int,int>/*空格*/ >ha;//二維
map<string,int>mas;//map
int main()


{
佇列
{
que.push(3);//進入
int duitou=que.front();//隊頭的人
que.pop();//去掉第一個人
int people=que.size()//佇列長度
}

{
sta.push(3);//進入
int zuishang=sta.top();//棧頂
sta.pop();//去掉棧頂的人
int people=sta.size();//棧高度
}

{
heap.push(3);//進入
int zuida=heap.top();//最大值
heap.pop();//去掉最大值
int daxiao=heap.size();//堆大小
}
}