-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5.cpp
More file actions
50 lines (36 loc) · 1.04 KB
/
5.cpp
File metadata and controls
50 lines (36 loc) · 1.04 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
using namespace std;
class Area {
public:
float findArea(int radius) {
return 3.14159 * radius * radius;
}
float findArea(float side) {
return side * side;
}
float findArea(float length, float width) {
return length * width;
}
float findArea(float base, float height, int type) {
return 0.5 * base * height;
}
};
int main() {
Area a;
int radius;
cout<<"Enter radius of circle : ";
cin >> radius;
cout << "Area of Circle: " << a.findArea(radius) <<endl;
float side;
cout<<"Enter side of square : ";
cin >> side;
cout << "Area of Square: " << a.findArea(side) << endl;
float length, width;
cout<<"Enter length and width of rectangle : ";
cin >> length >> width;
cout << "Area of Rectangle: " << a.findArea(length, width) <<endl;
float base, height;
cout<<"Enter base and height of triangle : ";
cin >> base >> height;
cout << "Area of Triangle: " << a.findArea(base, height, 0) << endl;
}