#include<iostream>
#include<map>
#include<stack>
using namespace std;
void main()
{
stack<int> st;
for (int i = 0; i < 100; i++)
{
st.push(i);
}
cout << "开始弹出堆栈的元素" << endl;
while (!st.empty())
{
cout << st.top() << endl;
st.pop();
}
}
本文介绍了如何使用C++的`stack<int>`数据结构存储并遍历100个整数,通过`push`和`pop`操作展示了元素的进出栈过程。
848

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



