// How to Find Area of a Circle with Diameter in C++ using Function Overloading
using namespace std;
// This function will calculate the area of the circle
// function with int data type parameter
void CalculateArea(int x) {
float d = 0, c = 0, a = 0;
// It will calculate the diameter, circumference, and area of the circle
d = (2 * x);
c = (2 * 3.14 * x);
a = 3.14 * (x * x);
// It will produce the final output
cout << "\n";
cout << "Diameter :: = " << d << " units\n";
cout << "Circumference :: = " << c << " units\n";
cout << "Area :: = " << a << " sq. units\n";
}
// function with float data type parameter
void CalculateArea(float x) {
float d = 0, c = 0, a = 0;
// d is the diameter of the circle
// c is the circumference of the circle
// a is the area of the circle
// It will calculate the diameter, circumference, and area of the circle
d = (2 * x);
c = (2 * 3.14 * x);
a = 3.14 * (x * x);
// It will produce the final output
cout << "\n";
cout << "Diameter :: = " << d << " units\n";
cout << "Circumference :: = " << c << " units\n";
cout << "Area :: = " << a << " sq. units\n";
}
// It's the driver function
int main() {
int a = 7;
float b = 10.4;