#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;

}

 

C++中的栈和队列

相关文章:

  • 2021-08-23
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2022-01-08
  • 2021-05-01
  • 2022-02-02
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2022-03-08
  • 2021-09-20
  • 2021-09-26
  • 2022-01-15
  • 2022-12-23
  • 2021-06-24
相关资源
相似解决方案