Sunday, 24 July 2011

PROGRAM IN C++ to find the area of cuboids, rectangle, circle, square using function overloading

Do you like this post?
#include
#include
int area(int,int,int);
int area(int,int);
float area(float,int);
int area(int);
int area(int l,int b,int h)
{
return(2*((l*b)+(b*h)+(l*h)));
}
int area(int l,int b)
{
return(l*b);
}
float area(float r=1.2)
{
return(3.14*r*r);
}
int area(int l)
{
return(l*l);
}
void main()
{
clrscr();
cout<<"\n The surface area of the cuboid is : "< cout<<"\n The area of the rectangle is : "< cout<<"\n The area of the circle is : "< cout<<"\n The area of the square is : "< getch();
}

No comments:

Post a Comment