【栈】

栈:先进后出

#include<stack>
#include<cstdio>
using namespace std;
int main()
{
    stack<int> s;
    s.push(1);//{}->{1}
    s.push(2);//{1}->{1.2}
    printf("%d\n",s.top());2
    s.pop();//从栈顶移除{1,2,3}->{1,2}
    printf("%d\n",s.top());
    return 0;
} 
View Code

 

posted @ 2017-09-06 22:44  LizLiz  阅读(75)  评论(0)    收藏  举报