标签:ack while int highlight names cin next space clu
#include <bits/stdc++.h> using namespace std; struct Stack{ int n,next; }s[10000]; vector<int> sav; int size=0,top=0; void push(int a){ size++; s[size].n=a; s[size].next=top; top=size; } void pop(){ top=s[top].next; } void out(){ for(int i=top;i;i=s[i].next) cout<<s[i].n<<‘ ‘; puts(""); } void open(int a){ top=sav[a]; } void save(){ sav.push_back(top); } int main(){ while(1){ int a; cin>>a; if(a==1){ int b; cin>>b; push(b); } if(a==2) pop(); if(a==3) out(); if(a==4){ int b; cin>>b; open(b); } if(a==5) save(); } return 0; }
标签:ack while int highlight names cin next space clu
原文地址:http://www.cnblogs.com/HC-LittleJian/p/7535201.html