#include <iostream>
#include <stack>
using namespace std;
int main()
{
stack<int> s;
s.push(1); //入栈
s.push(4);
s.push(5);
cout << s.top() << endl; //栈顶元素
s.top()++;
cout << s.top() << endl;
s.pop(); //弹栈
cout << s.top() << endl;
cout << s.size() << endl; //栈的尺寸
cout << s.empty() << endl; //栈是否为空
return 0;
}
7344

被折叠的 条评论
为什么被折叠?



