Showing posts with label PROGRAM to find the area of cuboid. Show all posts
Showing posts with label PROGRAM to find the area of cuboid. Show all posts

Thursday, 21 July 2011

PROGRAM to find the area of cuboid, rectangle, circle, square using function overloading in C++

#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();
}