
write a programme that calculates the area and circumference of a rectangle

#include<conio.h>
#include<iostream.h>
class rect
{
int l,b;
int area;
int peri;
public:
void get_rect()
{
cout<<"\n Enter length and breath of the rectangle :";
cin>>l>>b;
}
void calc()
{
area=l*b;
peri=2*l+2*b; // 2(l*b);
}
void display()
{
cout<<"\n The area of the rectangle is :"<<area;
cout<<"\n The perimeter of the rectangle is :"<<peri;
}
};
void main()
{
clrscr();
rect a;
cout<<"\n Area and perimeter of the rectangle:";
a.get_rect();
a.calc();
a.display();
getch();
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.