#include <iostream>
#include <stack>

using namespace std;

void test01() {
stack<int>stack1;

stack1.push(10);
stack1.push(20);
stack1.push(30);
stack1.push(40);

while (stack1.size() != 0) {
cout << "stack1.top(): " << stack1.top() << endl; // 输出栈顶元素
stack1.pop(); // 弹出栈顶元素
}

cout << "stack1.size(): " << stack1.size() << endl;
}


int main() {

test01();
}