- js24003 的博客
队列
- @ 2026-3-17 17:21:22
#include <bits/stdc++.h> //头文件
using namespace std;
queue<int> q;
/*
q.front() - 返回队列第一个元素的引用(最早入队的元素)
q.back() - 返回队列最后一个元素的引用(最新入队的元素)
q.empty() - 检查队列是否为空
q.size() - 返回队列中元素的个数
q.push(3) - 将元素加入队尾
q.pop() - 移除队首元素
*/
int main(){
//代码
q.push(3);
q.push(4);
q.pop();
cout<<q.size();
cout<<q.front();
return 0;
}