stack容器概念
stack容器的常用接口
#include<stack>
void test01()
{
stack<int> s1;
s1.push(13);
s1.push(23);
s1.push(34);
s1.push(56);
s1.push(13);
cout << "栈的大小为:" << s1.size() << endl;
// 只要栈不为空 查看栈顶元素 并执行出栈操作
while(!s1.empty())
{
cout << "栈顶元素为" << s1.top() << endl;
s1.pop();
}
cout << s1.size() << endl;
}
int main()
{
test01();
return 0;
}