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

class Rectangle
{
  int l;
  int b;

  public:
  void getval()
  {
    cout<<endl<<"Enter length and breadth of rectangle: ";
    cin>>l>>b;
  }

  inline int area()
  {
    return(l*b);
  }

  inline int volume(int h=10)
  {
    return(l*b*h);
  }
};//end of class

int main()
{
  Rectangle r;
  clrscr();
  r.getval();
  cout<<endl<<"Area of rectangle is: "<<r.area();
  cout<<endl<<"Enter height of rectangle: ";
  int h;
  cin>>h;
  cout<<endl<<"Volume of rectangle is: "<<r.volume(h);
  getch();
  return 0;
}

Post a Comment

Previous Post Next Post