#include <iostream>
#include <stack>
using namespace std;
void test01()
{
stack<int> s;
s.push(10);
s.push(20);
s.push(30);
cout << "s的大小:" << s.size() << endl;
while (!s.empty())
{
cout << "栈顶元素:" << s.top() << endl;
s.pop();
}
}
int main(int argc, char const *argv[])
{
/*stack是一种先进后出(FILO)的数据结构*/
test01();
return 0;
}
STL-stack
最新推荐文章于 2024-10-25 14:19:24 发布