-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangles.cpp
More file actions
89 lines (68 loc) · 1.36 KB
/
Copy pathTriangles.cpp
File metadata and controls
89 lines (68 loc) · 1.36 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
```
#include <iostream>
using namespace std;
int main(){
char enter;
double A;
double b;
double h;
double s1;
double s2;
top:
cout << "\n Enter 'A' to find the area \n Enter 'B' to find the base \n Enter 'H' to find the height \n Enter 'P' to find the perimeter \n Enter 'S' to stop "<<endl;
cin >> enter;
switch (enter){
case 'A':
goto fa;
case 'B':
goto fb;
case 'H':
goto fh;
case 'P':
goto fp;
case 'S':
return 0;
default:
cout << "\v Not a valid response, Did you make sure\n the letter was capitalized? " << endl;
goto top;
}
fa:
cout << " Enter base: ";
cin >> b;
cout << " Enter height: ";
cin >> h;
double a;
a=b*h/2;
cout << " The area is: "<< a << endl;
goto top;
fb:
cout << " Enter area: ";
cin >> A;
cout << " Enter height: ";
cin >> h;
double B;
B=A/h*2;
cout << " The base is: " << B << endl;
goto top;
fh:
cout << " Enter area: ";
cin >> A;
cout << " Enter base: ";
cin >> b;
double H;
H=A/b*2;
cout << " The height is: " << H << endl;
goto top;
fp:
cout << " Enter side 1: ";
cin >> s1;
cout << " Enter base: ";
cin >> b;
cout << " Enter side 2: ";
cin >> s2;
double P;
P= s1+b+s2;
cout << " The perimeter is: " << P << endl;
goto top;
}
```