Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

#include <iostream.

h>
#include<conio.h>
class Area
{
public:
float area(float l, float b)
{
return l * b;
}
};
class Perimeter {
public:
float perimeter(float l, float b) {
return 2 * (l + b);
}
};
class Rectangle : public Area, public Perimeter
{
float length, breadth; // Corrected 'breath' to 'breadth'
public:
void getdata() {
cout << "Enter Length: ";
cin >> length;
cout << "Enter Breadth: "; // Corrected spelling
cin >> breadth; // Corrected 'breath' to 'breadth'
}
void putdata()
{
cout << "Area of Rectangle= " << area(length, breadth) << endl;
cout << "Perimeter of Rectangle= " << perimeter(length, breadth) << endl;
}
};
Void main()
{
clrscr();
Rectangle r;
r.getdata();
r.putdata();
}

Enter Length: 35

Enter Breadth: 28

Area of Rectangle= 980

Perimeter of Rectangle= 126

You might also like