#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
class MyIntStack{//클래스를 선언했음
int p[10];
int tos;
public:
MyIntStack(){ tos = 0;}
bool push(int n);
bool pop(int &n);
};
bool MyIntStack:: push(int n){
this->p[n]=n;
if(tos == 10) return false; //stack full
else return true;
this->tos++;
}
bool MyIntStack::pop(int &n){
n = p[this->tos];
this-> tos = tos-1;
if(tos == -1) return false;//stack empty
else return true;
}
int main(){
MyIntStack a;
for(int i =0 ; i<11; i++){
if(a.push(i)==true){
cout << i << ' ';
}
else cout << endl << i+1 <<" 번째 stack full " << endl;
}
int n ;
cout << "tos = " << n <<endl;
for(int i=0; i<11 ; i++){
if(a.pop(n) == true) cout << n-1 << ' ';
else cout << endl << i+1 << " 번째 stack empty";
}
cout << endl;
}