blob: 15b9b7872a51f3da5ceaebfc75c23e472eade521 (
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
|
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#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;
bool isStable = false;
while (isStable == false) {
// prompt user for width and length input, then store into appropriate variables
cout << "Enter width (In centimeters): " << endl;
cin >> width;
cout << "Enter length (In centimeters): " << endl;
cin >> length;
// display the entered values back to the user
cout << "You entered: " << width << "cm for width, and: " << length << "cm for length" << endl;
// compute and siplay the area
area = ((width * length) / 2) / 10000;
cout << "The area for your kite is: " << area << " square meters" << endl;
//computer the aspect ratio and prompt user with warning if condition not met
aspect_ratio = (width / length);
if (aspect_ratio >= 1) {
cout << "Warning, an aspect ratio of :" << aspect_ratio << " is too high and will provide instability" << endl;
}
// otherwise break out successfully
else {
cout << "Aspect Ratio: " << aspect_ratio << endl;
break;
}
}
}
|