DIR Return Create A Forum - Home
---------------------------------------------------------
Class Discussion
HTML https://srm.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Programming in C++
*****************************************************
#Post#: 74--------------------------------------------------
FUNCTION OVERLOADING
DIR By: gaurav
Date: May 21, 2019, 6:12 am
---------------------------------------------------------
FUNCTION OVERLOADING
#include<iostream.h>
#include<conio.h>
int area(int a);
int area(int b, int c);
float area(float d, float e);
void main()
{
clrscr();
int side, length, breadth;
float base, height;
cout<<"THE AREA OF SQUARE:\n";
cout<<"Enter the side of the square >> ";
cin>>side;
cout<<"The area of square => "<<area(side)<<"\n";
cout<<"\nTHE AREA OF RECTANGLE:\n";
cout<<"Enter the length of the rectangle >> ";
cin>>length;
cout<<"Enter the breadth of the rectangle >> ";
cin>>breadth;
cout<<"The area of rectangle => "<<area(length,breadth)<<"\n";
cout<<"\nTHE AREA OF TRIANGLE:\n";
cout<<"Enter the base of the triangle >> ";
cin>>base;
cout<<"Enter the height of the triangle >> ";
cin>>height;
cout<<"The area of triangle => "<<area(base,height)<<"\n";
getch();
}
int area(int a)
{
return(a*a);
}
int area(int b, int c)
{
return(b*c);
}
float area(float d, float e)
{
return(0.5*d*e);
}
*****************************************************
Page 1 of 1