Sunday, January 26, 2014

C++ Program to demonstrate Function Overloading

with 0 Comment
C++ Program to demonstrate Function Overloading:

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
int volume(int);
double volume(double,int);
long volume(long,int,int);
int main()
{
clrscr();
cout<<"\nVolume of Cube "<<volume(10)<<"\n";
cout<<"\nVolume of Cylinder "<<volume(2.5,8)<<"\n";
cout<<"\nVolume of Rectangle "<<volume(100,75,15)<<"\n";
getch();
return(0);
}
int volume(int s)
{
return(s*s*s);
}
double volume(double r,int h)
{
return(3.14*r*r*h);
}
long volume(long l,int b,int h)
{
return(l*b*h);
}

0 comments:

Post a Comment

Powered by Blogger.

Blog Archive