Computer Science, asked by imkeziah, 2 months ago

write a program to find the area of a square, rectangle and circle using function overloading

name of the function is area

Answers

Answered by meanubhasingh
3

Answer:

include<iostream>

#include<cstdlib>

using namespace std;

float area(float r)

{

return(3.14 * r * r);

}

float area(float b,float h)

{

return(0.5 * b * h);

}

float area(float l,float b)

{

return (l * b);

}

int main()

{

float b,h,r,l;

int ch;

Explanation:

Pls mark me as brain list

Answered by akashkumaryadav87
1

Explanation:

include<iostream.h>

#include<conio.h>

const float pi=3.14;

float area(float n,float b,float h)

{

float ar;

ar=n*b*h;

return ar;

}

float area(float r)

{

float ar;

ar=pi*r*r;

return ar;

}

float area(float l,float b)

{

float ar;

ar=l*b;

return ar;

}

void main()

{

float b,h,r,l;

float result;

clrscr();

cout<<“\nEnter the Base & Hieght of Triangle: \n”;

cin>>b>>h;

result=area(0.5,b,h);

cout<<“\nArea of Triangle: “<<result<<endl

cout<<“\nEnter the Radius of Circle: \n”;

cin>>r;

result=area(r);

cout<<“\nArea of Circle: “<<result<<endl;

cout<<“\nEnter the Length & Bredth of Rectangle: \n”;

cin>>l>>b;

result=area(l,b);

cout<<“\nArea of Rectangle: “<<result<<endl;

getch();

}

Pls mark me as brainlist

Similar questions