C++中的栈和队列
#include<stdio.h>
#include<stack> //栈
#include<queue> //队列
using namespace std;
int main()
{
stack<int>s; //生命储存int类型的栈
s.push(1);
s.push(2);
s.push(3);
printf("%d\n",s.top());
s.pop();
printf("%d\n",s.top());
s.pop();
printf("%d\n",s.top());
s.pop();
queue<int>que;
que.push(1);
que.push(2);
que.push(3);
printf("%d\n",que.front());
que.pop();
printf("%d\n",que.front());
que.pop();
printf("%d\n",que.front());
que.pop();
return 0;
}