Welcome to Mike95.com
Home
WELCOME
ABOUT MIKE95.COM
CONTACT ME


Features
FUNNY JOKES
HUMAN FACTOR


C++
Library Source Code:
CGIPARSE
JSTRING
JVECTOR
JSTACK
JHASHTABLE


COM / ASP
MIKE95 COM SVR
- ASP STACK
- ASP QUEUE
- ASP VECTOR


Tutorials:
TEMPLATES
ALGORITHMS
DESIGN PATTERNS


Sample Work
Internet Based
TASK/BUG TRACKER


Visual C++ / MFC
FLIGHT PATH (C++)
MP3 PLAY LIST


Java
JAVA TALK
BAR GRAPH
WEB CAM


Personal
CONTACT ME
RESUME
PICTURES
TRIPS
JStack
/*
  This library was downloaded from: http://www.mike95.com

  This library is copyright.  It may freely be used for personal purposes
  if the restriction listed below is adhered to.
      Author: Michael Olivero
      Email:  mike95@mike95.com

  //===============================
  //Start of Restriction Definition
  //===============================
  Anyone can have full use of the library provided they keep this complete comment
  with the source.  Also I would like to ask if any changes are made to the
  code for efficiency reasons, please let me know so I may look into your change and
  likewise incorporate it into library.  If a suggestion makes it into the library,
  your credits will be added to this information.

  Authors of Computer related books are welcome to include this source code as part
  of their publishing, provided credit the Author and make note of where the source
  code was obtained from: http://www.mike95.com
  //=============================
  //End of Restriction Definition
  //=============================

  Description:
  Visit http://www.mike95.com/c_plusplus/classes/JStack/

  Standard LIFO (Last In First Out) datastructure.  It's public member functions
  are identical to the Java Stack public member functions (except for any Java specific
  Java related functions).
*/

#ifndef COM_MIKE95_COM_JSTACK_H

#include <stdlib.h>

template <class Etype>
class JStack
{
public:
    JStack();    // Constructor
    virtual ~JStack();

    //Inspectors
    //==========
    const Etype & peek() const;
    int isEmpty() const { return m_pTOS == NULL; }
    int search( const Etype &item ) const;

    //Modifiers
    //=========
    void empty();
    Etype pop();
    void push( const Etype &item );

protected:
    class node
    {
    public:
        node( const Etype &val, node *ptr ) : value( val ), next( ptr ) {}
        Etype value;
        node *next;

    };

private:
    node* m_pTOS;
};


#endif

(c)2024 Mike95.com / Site Disclaimer
Site Meter