Top Banner
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;
71

Object Oriented Programming Pointer in c++

Oct 03, 2015

Download

Documents

Object Oriented Programming Pointer in c++ programmes
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
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