Your Ad Here

Monday, February 4, 2008

FUNCTION OVERLOADING in C++

/* C++ Program For the IMPLEMENTATION OF FUNCTION OVERLOADING. The Program Finds the Area OF A Circle, Square and rectangle */

#include< iostream.h>
#include< conio.h>

int area(int);
int area(int,int);
float area(float);

void main()
{
clrscr();
cout< < " Area Of Square: "< < area(4);
cout< < " Area Of Rectangle: "< < area(4,4);
cout< < " Area Of Circle: "< < area(3.2);
getch();
}

int area(int a)
{
return (a*a);
}

int area(int a,int b)
{
return(a*b);
}

float area(float r)
{
return(3.14 * r * r);
}

/*****OUTPUT******
Area Of Square: 16 Area Of Rectangle: 16 Area Of Circle: 10.048 */

3 comments:

Minakshi said...

thank u very much for ur help frnd!:-)

Anonymous said...

We are a bunch of volunteers and starting a new scheme in our community.
Your site offered us with useful information to work
on. You've performed a formidable activity and our whole group will likely be thankful to you.

My web blog ... location voiture casablanca

Anonymous said...

thank u very much for ur help frnd

Your Ad Here