#include <iostream>
using namespace std;
class Rectangle {
private:
float length, breadth;
public:
// Constructor to initialize values
Rectangle(float l, float b) : length(l), breadth(b) {}
// Function to calculate area
float area() { return length * breadth; }
// Function to calculate perimeter
float perimeter() { return 2 * (length + breadth); }
// Function to display details
void display() {
cout << "Rectangle Details:\n";
cout << "Length: " << length << endl;
cout << "Breadth: " << breadth << endl;
cout << "Area: " << area() << endl;
cout << "Perimeter: " << perimeter() << endl;
}
};
int main() {
float l, b;
cout << "Enter length: ";
cin >> l;
cout << "Enter breadth: ";
cin >> b;
// Create object using constructor
Rectangle rect(l, b);
// Display rectangle details
rect.display();
return 0;
}