Function Overloading
#include<iostream>
#include<conio.h>
using namespace std;
void area(int,int,int);
void area(int,int);
void area(int);
int main()
{
int side=9;
area(side);
int len=7,bre=8;
area(len,bre);
int a=3,b=2,c=9;
area(a,b,c);
cout<<"\n END" ;
getch();
return 0;
}
void area(int a,int b,int c)
{
int s=a*b*c;
cout<<"\n Area of cylinder\t"<<s;
}
void area(int a,int b)
{
int s=a*b;
cout<<"\nArea of Rectangle\t"<<s;
}
void area(int a)
{
int area=a*a*a;
cout<<"\n Area of cube\t"<<area;
}
Sample Output:
Comments
Post a Comment
Thanks for the comment and don't forget to subscribe.