Monday, August 15, 2011

Implement the concept of stack in c++


PROGRAM:

#include<iostream.h>
#include<conio.h>
#define MAX 20

class stack
{
private:
int s[MAX];
int top,item;

public:
stack()
{
top=-1;
}

Sunday, August 7, 2011

Implementation of Unary operator overloading using friend function.


#include<iostream.h>
#include<conio.h>

class point
{
private:
int x,y;
public:
point(int i,int j)
{
x=i;
y=j;
}

Saturday, August 6, 2011

Implementation of Unary & Binary operator overloading using member function.


#include<iostream.h>
#include<conio.h>

class point     //class for unary operator overloading
{
private:
int x,y;
public:
point(int i,int j)
{
x=i;
y=j;
}