jituTechnology

jituTechnology

>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:
Name: Jitendra Kr Yadav
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
Add a comment

Comments (5)

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

Add a comment

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

Calendar

April 2024
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930