// tStack2.cpp     (C) 2004 adolfo@di-mare.com

/*  resultado
    Prueba el contenedor Stack.
*/

class Stack_int {
public:
    Stack_int()      { m_top = 0; return; }
    void   Push(int d) { m_vec[m_top] = d; m_top++; return; }
    int    Pop()       { m_top--; return m_vec[m_top]; }
    int    Top()       { return m_vec[m_top-1]; }
    int    Count()     { return m_top; }
private:
    enum { Capacity = 132 };
    int  m_top;           // tope de la pila
    int  m_vec[Capacity]; // vector para la pila
}; // Stack_int

int main() {
    Stack_int S;
    int d = -1;

    S.Push(1);    // 1
    S.Push(2);    // 1 2
    S.Push(3);    // 1 2 3
    S.Push(4);    // 1 2 3 4
    S.Push(5);    // 1 2 3 4 5

    d = S.Pop(); // 1 2 3 4    [5]
    d = S.Count();   // 4

    S.Push(6);    // 1 2 3 4 6
    d = S.Count();   // 5
    S.Push(7);    // 1 2 3 4 6 7
    d = S.Count();   // 6

    d = S.Pop(); // 1 2 3 4 6  [7]
    d = S.Count();   // 5

    return 0;
} // main()

// EOF: tStack2.cpp
