注意的是几个容器的区分:
对头只能出,队尾只能进;
#include<iostream>
#include<queue>
using namespace std;
void text01()
{
queue<int>q;
q.push(10);
q.push(20);
q.push(30);
q.push(40);
while (q.size() >0)
{
cout << q.front() << ' ';//输出对头
q.pop();//删除对头
}
}
int main()
{
text01();
return 0;
}