blob: 687ee4cec4354d52431362a93d845648829f4100 (
plain) (
blame)
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
90
|
// CST 116, Lab 1 - Alexandra Apetroaei
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
float width;
float length;
float area;
float mass;
float aspect_ratio;
float grav_pull;
float isStable = true;
float range = false;
while (isStable == true)
{
while (range == false)
{
cout << "Insert width (in centimeters): " << endl;
cin >> width;
cout << "Insert length (in centimeters): " << endl;
cin >> length;
if (width < 1 && length < 1 && width > 400 && length > 400)
{
cout << "Keep range between 1-400." << endl;
}
else {
range = true;
break;
}
}
cout << "You entered:" << width << "cm for width and :" << length << "cm for length." << endl;
aspect_ratio = (width / length);
//Compute total area
area = ((width * length) / 2) / 10000;
cout << "The area of the kite is: " << area << "in meters squared." << endl;
cin >> area;
//Compute total mass
mass = (area * 135) / 10000;
cout << "The mass of your kite is: " << mass << " kilograms." << endl;
cin >> mass;
//Compute gravitational pull
grav_pull = mass * 9.8;
cout << "The gravitional pull of your kite is: " << grav_pull <<
"meters per second squared." << endl;
cin >> grav_pull;
if (aspect_ratio >= 1)
{
cout << "Warning: " << aspect_ratio << " is too high and should be lowered to provie stability! " << endl;
}
else
{
cout << "Aspect ratio:" << aspect_ratio << endl;
break;
}
}
}
|