栈先进后出
s.push()入栈
s.pop()出栈即弹出栈顶元素
s.top()返回栈顶元素
s.size()返回栈中元素的个数
#include<stdio.h>
#include<algorithm>
using namespace std;
#include<stack>
int main()
{
int count;
stack<int>s;
s.push(8);
s.push(9);
count=s.size();
printf("%d\n",count);
while(!s.empty())
{
printf("%d\n",s.top());
s.pop();
}
return 0;
}