#include<cstdio>
#include<iostream>
#include<stack>
//#define N 1005
using namespace std;
//手动实现堆栈
//int s[N];
//int top=0;
//push函数和pop函数手动模拟stack
//void push(int item){
// s[++top]=item;
//}
//bool pop(){
// if(!top) return false;
// --top;
// return true;
//}
int main()
{
// push(1);
// push(2);
// push(3);
// cout<<pop()<<endl;
// cout<<pop()<<endl;
// cout<<pop()<<endl;
// cout<<pop()<<endl;
// cout<<pop()<<endl;
stack<int> s;
s.push(1);
s.push(2);
s.push(3);
s.pop();
cout<<s.top()<<endl;
cout<<s.size()<<endl;
while(!s.empty()){
cout<<s.top()<<endl;
s.pop();
}
}
stack
最新推荐文章于 2024-03-30 17:16:12 发布