blob: f43a99e6ce1ecca528fb50934ec2b3f55f8a5cb0 (
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
|
// CST 116, Lab 1 - Alexandra Apetroaei
#include <iostream>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
int main()
{
float width;
float length;
float area;
float aspect_ratio;
float isStable = false;
while (isStable == false)
{
// Ask user for width and length in centimeters
cout << "Insert width (in centimeters): " << endl ;
cin >> width;
cout << "Insert length (in centimeters): " << endl ;
cin >> length;
// Display width and length to user
cout << "You entered: " << width << "cm for width, and " << length << "cm for length" << endl;
// Formula to compute area of a kite
area = ((width * length) / 2) / 1000;
cout << "The area of the kite is: " << area << "in square meters" << endl;
aspect_ratio = (width / length);
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;
}
return 0;
}
}
|