main.cpp

 #include <iostream.h>
#include "Stack.h"


//////////////////////////////////////////////////////////////////////////
// Basic point class used for demonstrating the usage of LinkedList
//////////////////////////////////////////////////////////////////////////
class point
{
public:
int x,y;
point (int n1=0, int n2=0):x(n1),y(n2){};
bool operator!=(point &p2)
{
if (p2.x==x && p2.y==y)
return false;
return true;
}
bool operator==(point &p2)
{
if (p2.x==x && p2.y==y)
return true;
return false;
}
void print()
{
cout<<"( "<<x<<" , "<<y<<" )"<<endl;
}
};



void main()
{
Stack<point> ST;
point a(1,2), b(3,4), c(5,6), d(10,10), e(0,0), f(8,4);
point t;

cout<<"Adding items to the Stack..."<<endl;
ST.Push(a);
ST.Push(b);
ST.Push(c);
ST.Push(d);
ST.Push(e);
ST.Push(f);

cout<<"Printing Stack..."<<endl;
while (!ST.isEmpty())
{
t=ST.Pop();
t.print();
}

}

Project Homepage: