object oriented programming pointer in c++

71
Chapter 5 Example 1 : Program to find area of rectangle & Perimeter #include<iostream.h> #include<conio.h> class rectangle { private : int len, br; public: void area_peri( ); //prototype declaration, to be defined void getdata ( ) { cout<<endl<<"Enter length and breadth "; cin>>len>>br; } void setdata (int l, int b ) { len = l; br = b; } void displaydata( ) { cout<<endl<<"length = "<<len; cout<<endl<<"breadth = "<<br; } }; //………………Member Function Definition………………… void rectangle :: area_peri( ) { int a, p; a = len * br; p = 2 * (len +br); cout<<endl<<"Area = "<<a; cout<<endl<<"Perimeter = "<<p;

Upload: jaikumarguwalani

Post on 03-Oct-2015

12 views

Category:

Documents


0 download

DESCRIPTION

Object Oriented Programming Pointer in c++ programmes

TRANSCRIPT

Chapter 5

Chapter 5Example 1 : Program to find area of rectangle & Perimeter

#include

#include

class rectangle

{

private :

int len, br;

public:

void area_peri( ); //prototype declaration, to be defined

void getdata ( )

{

coutbr;

}

void setdata (int l, int b )

{

len = l;

br = b;

}

void displaydata( )

{

cout