C++中sqtack的意思,还有用法,谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/05 00:31:51
如题

是stack吧?栈的特点先进后出,通常有两种重要的操作,pop出栈,push入栈。

#include <stack>
#include <iostream>
using namespace std;

int main()
{
stack<int> s;
s.push(88);
s.push(77);
s.push(66);

cout<<s.top()<<endl;
s.pop();
cout<<s.top()<<endl;
s.pop();
cout<<s.top()<<endl;
}