#include <iostream>
using namespace std;
#define pi 3.141916
class fun
{
public:
void area(int);
void area(int,int);
void area(float,int,int);
};
void fun::area(int a)
{
cout<<"Area of Circle: "<<pi*a*a;
}
void fun::area(int a,int b)
{
cout<<"Area of Rectangle: "<<a*b;
}
void fun::area(float t,int a,int b)
{
cout<<"Area of Triangle: "<<t*a*b;
}
int main()
{
int a,b,r;
fun obj;
cout<<"\nEnter radius of the Circle: ";
cin>>r;
obj.area(r);
cout<<"\nEnter sides of Rectangle: ";
cin>>a>>b;
obj.area(a,b);
cout<<"\nEnter sides of Triangle: ";
cin>>a>>b;
obj.area(0.5,a,b);
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter radius of the Circle: 7
Area of Circle: 153.954
Enter sides of Rectangle: 5
5
Area of Triangle:25
Enter sides of Triangle:10
5
Area of Triangle:25
Area of Circle: 153.954
Enter sides of Rectangle: 5
5
Area of Triangle:25
Enter sides of Triangle:10
5
Area of Triangle:25