forked from Backslash-Computing-Society/Hacktober
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest3.cpp
More file actions
52 lines (50 loc) · 937 Bytes
/
test3.cpp
File metadata and controls
52 lines (50 loc) · 937 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<iostream>
#include<cmath>
using namespace std;
//void area()
//{
// float b,h;
// cout<<"Enter base of right angled triangle: ";
// cin>>b;
// cout<<"Enter height of right angled triangle: ";
// cin>>h;
// float a=0.5*b*h;
// cout<<"Area: "<<a;
//}
float area(float x, float y=3)
{
float a=0.5*x*y;
return a;
}
//float area(float s=4)
//{
// float a= (sqrt(3)/4)*s*s;
// return a;
//}
int main()
{
int c;
cout<<"Area of:-\n1. Right angled triangle\n2. Isosceles triangle\n3. Equilateral traingle\n";
cin>>c;
switch(c)
{
case 1:
// cout<<area();
break;
case 2:
float b1,h1;
cout<<"Enter base of triangle: ";
cin>>b1;
cout<<"Enter height of triangle: ";
cin>>h1;
cout<<"Area: "<<area(b1,h1);
break;
case 3:
// float side;
// cout<<"Enter side of triangle: ";
// cin>>side;
// cout<<"Area: "<<area(side);
break;
}
return 0;
}