队列

来源:互联网 发布:软件系统演示评分标准 编辑:程序博客网 时间:2024/06/06 09:11
#include<iostream>#include<cstdio>#include<queue>using namespace std;int main(){    int a=1,b=2;    queue<int>q;    q.push(a);    q.push(b);       //  从队尾入队    q.pop();       //    从队首出队    cout<<q.front();  // 返回队首的值    cout<<q.back();   // 返回队尾的值    cout<<q.size();   // 返回队列元素的个数    cout<<q.empty();   //判断队是否为空 为空则返回 1    q.pop();    cout<<q.empty();    return 0;}

0 0
原创粉丝点击