// Program to display area of multiple rectangls using array of objects

| |

// Program to display area of multiple rectangls using array of objects
//In which each object is initialize using constructor
#include<iostream.h>
#include<conio.h>
class rectangle
{
private:
int length;
int breadth;
public:
rectangle(int l,int b)
{
length=l;
breadth=b;
}
void showarea()
{
cout<<"\nArea of rectangle="<<length*breadth;
}
};
int main()
{rectangle
r[3]={rectangle(5,6),rectangle(7,8),rectangle(5,7)};
cout<<"\nDisplay areas of rectangle";
for(int i=0;i<3;i++)
r[i].showarea();
return 0;
}
<