0% found this document useful (0 votes)
16 views1 page

Function Overloadig

Uploaded by

gurly101
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

Function Overloadig

Uploaded by

gurly101
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

//EXP 18.

3
/*
C++ program to find area of square, rectangle, circle and triangle by using function ov
*/
#include<iostream>
using namespace std;

int area(int s) {
return(s*s);
}

int area(int l,int b) {


return(l*b);
}

float area(float r) {
return(3.14*r*r);
}

float area(float bs,float ht) {


return((bs*ht)/2);
}

int main() {
int s,l,b;
float r,bs,ht;

cout<<"Enter side of a square:";


cin>>s;

cout<<"Enter length and breadth of rectangle:";


cin>>l>>b;

cout << "Enter radius of circle:";


cin >> r;

cout << "Enter base and height of triangle:";


cin >> bs >> ht;

cout << "Area of square is"<<area(s);


cout << "\nArea of rectangle is "<<area(l,b);
cout << "\nArea of circle is "<<area(r);
cout << "\nArea of triangle is "<<area(bs,ht);
}

You might also like