# >Write a program to find the area of cube, cylinder and rectangle using the concept of function overloading

>/* Write a program to find the area of cube, cylinder and rectangle using the concept of function overloading

Programmed by:
Roll: 10116 (NCIT-ELX)
Date: 12 july 2011 */
#include <iostream.h>
#include <conio.h>
inlineint area(int a)
{
return(6*a*a);
}
inline float area(float a, float b)
{
return(3.14*a*(a+b));
}
inlineint area(int a, int b)
{
return(a*b);
}
int main()
{
intlcu,lr,br;
floatrcy,hcy;
cout<<“Enter the length of cube: “;
cin>>lcu;
cout<<“Enter the radius and height of cylinder: “;
cin>>rcy>>hcy;
cout<<“Enter the length and breadth of rectangle: “;
cin>>lr>>br;
cout<<“The area of cube is: “<<area(lcu)<<endl<<“The area of cylinder is: “<<area(rcy,hcy)<<endl<<“The area of rectangle is: “<<area(lr,br);
getch();
return(0);
}
Output Sample:
Enter the length of cube: 2
Enter the radius and height of cylinder: 3
4
Enter the length and breadth of rectangle: 5
6
The area of cube is : 24
The area of cylinder is 65.94
The area of rectangle is : 30

1. AnonymousJuly 13, 2011
>i run ur program, but it directly didnt give the output, i need to edit it… any reason?
[email protected]
2. AnonymousJuly 13, 2011
>Is it right programming?
3. AnonymousJuly 14, 2011
>its working cool,on my borland ,,thanks!!!
4. sunil(sonu) rajputJuly 14, 2011
>Ramro chaa, Its working. Thanks a lot…
5. Sandeep DhakalJuly 15, 2011
>Bindaaas chaa babbbal chaaa,its working cool!!!!

This site uses Akismet to reduce spam. Learn how your comment data is processed.

### Connect with Me

GPO 8973 NPC 541; Kathmandu Nepal
Phone: +977 9851236800