/*
Write a program to compute the area of a triangle
and a circle by overloading the area( ) function.
*/
#include<iostream>
using namespace std;
void area(int base,int height) //Triangle
{
cout<<"\n\n Area of Triangle : "<<0.5*base*height;
}
void area(int radius)// Circle
{
cout<<"\n\n Area of Circle : "<<3.14*radius*radius;
}
int main()
{
area(10,15);
area(5);
return 0;
}
Write a program to compute the area of a triangle
and a circle by overloading the area( ) function.
*/
#include<iostream>
using namespace std;
void area(int base,int height) //Triangle
{
cout<<"\n\n Area of Triangle : "<<0.5*base*height;
}
void area(int radius)// Circle
{
cout<<"\n\n Area of Circle : "<<3.14*radius*radius;
}
int main()
{
area(10,15);
area(5);
return 0;
}