diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 5cb2039..bf375fb 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -10,24 +10,39 @@ using namespace std; +const float kite_weight = 135; int main() { float width = 0, length = 0; - cout << "Please input your kites width in centimeters: "; - cin >> width; - - cout << endl; + while (width < 1 || width > 400) + { + cout << "Please input your kites width in centimeters: "; + cin >> width; + cout << endl; + if (width < 1 || width > 400) + { + cout << "Width cannot be greater than 400 or less than 1." << endl; + } + + } - cout << "Please input your kites height in centimeters: "; - cin >> length; - cout << endl; + while (length < 1 || length > 400) + { + cout << "Please input your kites length in centimeters: "; + cin >> length; + cout << endl; + if (length < 1 || length > 400) + { + cout << "Length cannot be greater than 400 or less than 1." << endl; + } + } - cout << "Your kites width will be: " << width << " cm\nYour kites height will be: " << length << " cm" << endl; + cout << "Your kites width will be: " << width << " cm\nYour kites length will be: " << length << " cm" << endl; - float area = (width / length) / 10000; + float area = ((width * length)/2) / 10000; cout << "The area of your kite in square meters is " << area << endl; @@ -37,7 +52,11 @@ int main() cout << "Your aspect ration is greater than 1 (width/length: " << width << "/" << length << " = " << aspect_ratio << ")\nLower aspect ratios will have greater stability." << endl; } + float mass = (area * kite_weight) / 10000; + cout << "Your kites mass is: " << mass << "kg." << endl; + float gravitational_pull = mass * 9.8; + cout << "The kites gravitational pull is: " << gravitational_pull << "N/kg." << endl; } |