blob: 166f731efbda6d6571cc544aaef1c80ac3a4ae1e (
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
|
// 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 = 0;
float length = 0;
float area;
float mass;
float aspect_ratio;
while (true) {
cout << "What is the width of the kite in centimeters: ";
if (cin >> width && (width >= 1 && width <= 400)) {
break;
}
cout << "Please enter a number between 1 and 400 centimeters." << endl;
}
while (true) {
cout << "What is the length of the kite in centimeters: ";
if (cin >> length && (length >= 1 && length <= 400)) {
break;
}
cout << "Please enter a number between 1 and 400 centimeters." << endl;
}
cout << "\nThe width is " << width << " centimeters and the length is "
<< length << " centimeters." << endl;
area = (length * width) / 2;
cout << "The area of the kite is " << area / 10000 << " square meters." << endl << endl;
aspect_ratio = width / length;
if (aspect_ratio >= 1)
cout << "WARNING! Aspect ratio >= 1. Unstable.\n";
else if (aspect_ratio < 1)
cout << "Aspect ratio < 1. Good aspect ratio.\n";
mass = 135 * (area / 10000);
cout << "\nThe mass of your kite is " << mass << " grams / sq meter.\n";
return 0;
}
|