Friday, 22 March 2019

CPP-EX32

Function volume() is overload three times

#include<iostream.h>
#include<conio.h>

//Declarartion (prototypes)
int volume(int);
double volume(double,int);
long volume(long ,int,int);

void main()
{
clrscr();
cout<<"\n"<<"\n Cube:-"<<volume(10);
cout<<"\n"<<"\n Cylinder:-"<<volume(4,5);
cout<<"\n"<<"\n Rectangular:-"<<volume(100L,45,15);

getch();

}

//function definitions

int volume(int s)//cube
{
return(s*s*s);
}

double volume(double r,int h)//cylinder
{
return(3.14 *r*r*h);
}


long volume(long l,int b,int h)//rectangular box
{
return(l*b*h);
}