当前位置:网站首页>第十章 STL 之 stack
第十章 STL 之 stack
2022-07-17 10:23:00 【qq_43205256】
1 stack 基本概念

2 stack 常用接口
#include <iostream>
using namespace std;
#include <stack>
//栈容器常用接口
void test01()
{
//创建栈容器 栈容器必须符合先进后出
stack<int> s;
//向栈中添加元素,叫做压栈
s.push(10);
s.push(20);
s.push(30);
while (!s.empty())
{
//输出栈顶元素
cout << "栈顶元素为: " << s.top() << endl;
//弹出栈顶元素
s.pop();
}
cout << "栈的大小为:" << s.size() << endl;
}
int main()
{
test01();
return 0;
}输出结果:
栈顶元素为: 30
栈顶元素为: 20
栈顶元素为: 10
栈的大小为:0边栏推荐
- Latest fruit flstudio20.9 low version upgrade high version tutorial
- How to build your own cloud database in docker
- Go-Excelize API源码阅读(二)——OpenFile()
- MySQL view
- LDA classifier
- Anycontrol demo demo demo
- Fundamentals of C language -- 2-3 pointers and arrays
- 目标检测模型大小计算,模型复杂度(参数换算公式)
- 2022-07-16:以下go语言代码输出什么?A:[];B:[5];C:[5 0 0 0 0];D:[0 0 0 0 0]。 package main imp
- [paper notes] Research on end positioning of grab manipulator based on multi-sensor data fusion
猜你喜欢

KNN分類器

两个结构体 ifconf 和 ifreq

【C语言】指针练习题2——笔试真题及解析

Anaconda与Jupyter Notebook入门级详细使用教程

Resolve the applicationeventmulticast not initialized - call 'refresh' before multicast events exception
![[paper notes] Research on end positioning of grab manipulator based on multi-sensor data fusion](/img/bb/9db231fe4b01c0f3f91e67143bda0c.png)
[paper notes] Research on end positioning of grab manipulator based on multi-sensor data fusion

C语言基础篇 —— 2-1 指针与野指针

C51 常见数据类型详解

【C语言】浮点型在内存的存储

Static routing!! Static routing!! Static routing!!
随机推荐
LDA classifier
codeforces每日5题(均1500)-第十七天
Anycontrol demo demo demo
【C语言】自定义类型初阶知识点
EBay searches eBay products by keyword API return value description
Static routing!! Static routing!! Static routing!!
how to use culasLt
银河麒麟v10-arm版离线安装Portainer
Simple third-party component log desensitization
Day 6 training
[hero planet July training leetcode problem solving daily] 17th kuansou
C语言基础篇 —— 2-3 指针与数组
第一部分—C语言基础篇_5. 数组和字符串
企业数字化转型,为何 SaaS 模式如此重要?
Use < pre > and json Stringify handles the format of web page presentation JSON
Line Flow Based Simultaneous Localization and Mapping
The inflection point of eth may be just around the corner, which is how to
Es conceptual model and basic faults
【摸鱼神器】UI库秒变低代码工具——表单篇(二)子控件
Resolve the applicationeventmulticast not initialized - call 'refresh' before multicast events exception