// Justin C. Miller
// made for : http://www.geocities.com/neonprimetime.geo/index.html
// 3-15-2001
// Description : Stack of 10 Integers at max
// made on MS Visual C++ 6.0

#include 
#include 

const int max = 10 ;

class Stack{
private:
	int stack[max] ;
	int size ;
	int top ;
public:
	Stack(){
		size = 0 ;
		for(int i = 0 ; i < max ; i++)
			stack[i] = -999999 ;
		top = -1 ;
	}
	~Stack(){}
	bool Push(int x){
		if(top < max){
			stack[top+1] = x ;
			top = top + 1 ;
			return true ;
		}
		return false ;
	}
	int Pop(){
		if(top >= 0){
			top = top - 1;
			return stack[top + 1] ;
		}
		return -999999 ;
	}
	void PrintStack(){
		cout << "Stack" << endl ;
		cout << "-----" << endl ;
		for(int i = top ; i >= 0 ; i--)
			cout << stack[i] << endl ;
	}
};

int main(){
	Stack a ;
	int x ;
	
	for(int i = 0 ; i < 10 ; i++){
		cout << "Please enter integer #" << (i+1) << endl ;
		cin >> x ;
		if(!a.Push(x)){
			cout << "Stack is Full!" << endl ;
			cout << "Number not inserted!" << endl ;
		}
	}

	a.PrintStack() ;
	system("pause") ;

	cout << "\nThese 2 numbers are being popped of the stack" << endl ;
	for(x = 0 ; x < 2 ; x++)
		cout << a.Pop() << endl ;

	a.PrintStack() ;
	system("pause") ;

	return 0 ;
}

    Source: geocities.com/neonprimetime.geo/cpp/cpp_SourceCode

               ( geocities.com/neonprimetime.geo/cpp)                   ( geocities.com/neonprimetime.geo)