C++ stack 容器

C++ stack 容器

cpp 复制代码
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;

void test01()
{
	stack<int>s;

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

	while (!s.empty())
	{
		cout << "栈顶元素->" << s.top() << endl;
		s.pop();
	}
}

int main()
{

	test01();

	return 0;
}
相关推荐
隐积1 小时前
3.1.7.Qt容器大家族(3):QVariant——万能盒子
开发语言·qt
Tri_Function4 小时前
动态规划DP1(c++)
c++
名字还没想好☜4 小时前
Next.js ‘use client‘ 到底加在哪:Server/Client Components 边界与常见报错
开发语言·前端·javascript·react·next.js
初级代码游戏5 小时前
iOS开发 Swift 速记1:变量和基本数据类型
开发语言·ios·swift
酷在前行6 小时前
【R生态】PERMANOVA 进阶实战:距离选择、PERMDISP、两两比较与受限置换(保姆级教程)
开发语言·r语言
cxr8286 小时前
Graphify vs GitNexus vs CodeGraph — 三工具架构深度对比
开发语言·架构·知识图谱
清水迎朝阳6 小时前
客户端软件 — 用户统计方案
服务器·c++·客户端·用户统计
废弃的小码农7 小时前
功能测试--Day07--Python编程基础
开发语言·python
再卷也是菜8 小时前
C++17(下)
c++
fengci.8 小时前
Microweber CMS 未授权路径穿越漏洞(CVE-2026-65694)
android·开发语言·前端·学习·php