C++ 提高教程 STL stack容器
# include<iostream>
# include<stack>
using namespace std;
void test01()
{
stack<int>s;
s.push(10);
s.push(20);
s.push(30);
s.push(40);
while ((!s.empty()))
{
cout << "栈顶元素为:" << s.top() << endl;
s.pop();
}
cout << "stack的大小" <<s.size()<< endl;
}
int main()
{
test01();
system("pause");
return 0;
}