C++所提供的类模板应用(堆栈)

 #include <iostream>
 using namespace std;
 #include<stack>
 
 int main(int argc, char *argv[])
 {
 stack<int>st;
 int x;
 
 while(scanf("%d",&x),x)  st.push(x);
 
 while(!st.empty())
 {
     	x=st.top();
 	     printf("%d ",x);
 	  st.pop();
 }
 	
 	return 0;
 }


猜你喜欢

转载自blog.csdn.net/u010608296/article/details/80973776
今日推荐