STL queue
queue單向隊列,一共6個常用函數front()、back()、push()、pop()、empty()、size()。
#include <stdio.h> #include <queue>using namespace std;int main() {int n, m, size;queue <int> q;//定義隊列qq.push(1);q.push(2);//將1 、2壓入隊列while (!q.empty())//判斷隊列是否為空{n = q.front();//返回隊列頭部數據m = q.back();//返回隊列尾部數據size = q.size();//返回隊列里的數據個數q.pop();//隊列頭部數據出隊printf("%d %d %d\n", n, m, size);}return 0; }總結
- 上一篇: 使用Jmeter进行http接口测试
- 下一篇: java使用MD5加密