队列是一种链表的存储结构
队列的头文件 && 声明
#include<queue>
using namespace std;
//或者是
#include<bits/stdc++.h>
using namespace std;
queue</*任意数据类型,可以是结构体*/>队列名;
队列的常用成员函数
/*
queue的成员函数
empty 测试容器是否为空,为空时返回true
size 返回容器的长度
front 返回队列的第一个元素,队首
back 返回队列的最后一个元素,队尾
push 把元素添加至队列尾
pop 弹出队列首元素
*/
#include<bits/stdc++.h>
using namespace std;
queue<int>q; //任意数据类型,可以是结构体
int n,i;
int main(){
cin>>n;
for(i=1;i<=n;i++)q.push(i);
cout<<q.empty()<<endl;
while(!q.empty()){
cout<<q.front()<<" "<<q.back()<<" "<<q.size()<<endl;
q.pop();
}
return 0;
}