source code name: fnover2.cpp
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
void area(int r)
{
float ac=3.142*r*r;
cout<<" \n area of Circle "<< ac;
}
void area(int a, int b)
{
int ar=a*b;
cout<< "\n area of rectangle: "<<ar;
}
void area(long b, int h)
{
long at=(b*h)/2;
cout<<"\n area of triangle: "<<at;
}
void main()
{
clrscr();
cout<<"function overloading program ";
area(4);
area(12,8);
area(120l,10);
getch();
}
output:
function overloading program
area of Circle:50.272
area of rectangle:96
area of triangle:600
0 Comments
Post a Comment