# Untitled

unknown
plain_text
6 months ago
1.9 kB
1
Indexable
Never
```#include <iostream>
#include <cmath>

using namespace std;

// Function to compute the area of a triangle
float area(float side1, float side2, float side3)
{
float s = (side1 + side2 + side3) / 2;
return sqrt(s * (s - side1) * (s - side2) * (s - side3));
}

// Function overload to compute the area of a triangle with default side value
float area(float side1, float side2)
{
return area(side1, side2, 5);
}

// Function to compute the area of a square
float area(float side)
{
return side * side;
}

// Function to compute the area of a circle
{
}

int main()
{
float side1, side2, side3;

cout << "Enter the sides of the triangle: ";
cin >> side1 >> side2 >> side3;
cout << "Area of the triangle: " << area(side1, side2, side3) << endl;

cout << "Enter the side of the square: ";
cin >> side1;
cout << "Area of the square: " << area(side1) << endl;

cout << "Enter the radius of the circle: ";
cout << "Area of the circle: " << area(radius) << endl;

return 0;
}

#include <iostream>

using namespace std;

// Base class 1
class Base1 {
public:
Base1() {
cout << "Base1 constructor called" << endl;
}

~Base1() {
cout << "Base1 destructor called" << endl;
}
};

// Base class 2
class Base2 {
public:
Base2() {
cout << "Base2 constructor called" << endl;
}

~Base2() {
cout << "Base2 destructor called" << endl;
}
};

// Derived class
class Derived : public Base1, public Base2 {
public:
Derived() {
cout << "Derived constructor called" << endl;
}

~Derived() {
cout << "Derived destructor called" << endl;
}
};

int main() {
Derived derivedObj;
return 0;
}
```