-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path71.cpp
More file actions
34 lines (33 loc) · 827 Bytes
/
Copy path71.cpp
File metadata and controls
34 lines (33 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Write a Program to Compute area of Circle, area of Rectangle, area of Triangle Depending on User Choice
using Overloading Function Area.*/
#include<iostream>
using namespace std;
int area(int,int);
float area(float);
float area(float,float);
int main()
{
int l,b;
float r,bs,ht;
cout<< "Enter Length and Breadth of Rectangle: " << endl;
cin>> l>>b;
cout<< "\nEnter Radius of Circle: ";
cin>>r;
cout<< "\nEnter Base and Height of Triangle: " <<endl;
cin>>bs>>ht;
cout<< "\nArea of Rectangle is "<<area(l,b);
cout<< "\nArea of Circle is "<<area(r);
cout<< "\nArea of Triangle is "<<area(bs,ht);
}
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);
}