#include<iostream>
#include<stack>
using namespace std;
int n=10;
int main(){
stack<int>s;
int a[]={1,2,3,4,5,6,7,8,9,10};
for(int i=0;i<10;i++){
s.push(a[i]);
}
for(int i=0;i<10;i++){
printf("%d ",s.top());
s.pop();
}
}
输出结果:
10 9 8 7 6 5 4 3 2 1
--------------------------------
Process exited after 0.3249 seconds with return value 0
请按任意键继续. . .