6

【笔记】C++的stack容器

 2 years ago
source link: https://feiju12138.github.io/2022/09/09/C-%E7%9A%84stack%E5%AE%B9%E5%99%A8/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【笔记】C++的stack容器

2022-09-09C++学习指北

1

C++的stack容器学习笔记stack容器的数据结构是栈,遵循先进后出的规则因为栈只有栈顶能被访问,所以栈不能被遍历

引入头文件

#include <stack>
stack<T> s;
stack<T> s(s);
s = s;

容量和大小的操作

容器是否为空

s.empty();

获取容器中元素的个数

s.size();

增(入栈)

<element>:元素

s.push(<element>);

删(出栈)

s.pop();
s.top();

哔哩哔哩——黑马程序员

昵称
邮箱
网址(可选)
Powered by Waline v1.6.0
© 2022 绯鞠
15380 20754

本站已稳定运行 2 年 293 天 20 小时 37 分钟 14 秒

欢迎阅读「【笔记】C++的stack容器 | 绯鞠的博客」


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK