Function overloading program using cpp
Function overloading program
Write a program to find the volume of cube,cylinder,rectangular box using function overloading.
#include<conio.h>
int volume(int);
double volume(double,int);
long volume(long,double,int);
int main()
{
clrscr();
cout<<volume(10)<<"\n";
cout<<volume(2.5,8)<<"\n";
cout<<volume(100,75,15)<<"\n";
return 0;
}
int volume(int s)
{
return s*s*s;
return s*s*s;
}
double volume(double r,int h)
{
return(3.14*r*r*h);
}
long volume(long l,int b,in h)
{
return(l*b*h);
}
Output
1000
157
112500
No comments: