Program for Function Overloading.
Code :-
/************Programe
for Function Overloading***************/
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
int
volume(int);
double
volume(float,int);
double volume(long,int,int);
int
volume(int r)
{
return(r*r*r);
}
double
volume(float r,int h)
{
return(3.14*r*r*h);
}
double volume(long l ,int b, int h)
{
return(l*b*h);
}
main()
{
clrscr();
cout<<"\n"<<"CUBE="<<volume(5);
cout<<"\n"<<"CYLINDER=
"<<volume(2.5,5);
cout<<"\n"<<"RECTANGLE="<<volume(5,4,3);
getch();
return(0);
}
/*********************OUT
PUT******************
CUBE=125
CYLINDER=
98.125
RECTANGLE=60
***********************************************/
Output :-
CUBE=125
CYLINDER= 98.125
RECTANGLE=60
CUBE=125
CYLINDER= 98.125
RECTANGLE=60