Pages

100 Contemporary Living Room Designs

Thursday, August 2, 2012

PROGRAM TO FIND THE AREA OF A RECTANGLE USING FUNCTION DEFINITION INSIDE CLASS


#incluce<iostream.h>
#include<conio.h>
class rectangle
{
   int length,breadth,area;
   public:
   void readvalues()
   {
       cout<<"Enter length and breadth\n";
       cin>>length>>breadth;
   }
   void recarea()
  {
      area=length*breadth;
      cout<<"Area is : "<<area;
  }
};
void main()
{
    clrscr();
    rectangle r1;   // object creation
    r1.readvalues();  //function call using dot operator
    r1.recarea();            //recarea() function call
    getch();
}

1 comment:

  1. plz add the program to overload function an area of rectengle

    ReplyDelete