diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 105 |
1 files changed, 104 insertions, 1 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ed5f807..cec5902 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -2,6 +2,7 @@ // #include <iostream> +#include <iomanip> using namespace std; @@ -9,8 +10,110 @@ using std::cout; using std::cin; using std::endl; +float GetLength(); +float GetWidth(); +//void CalcArea(float length, float width); + int main() { - cout << "Hello World!\n"; + float length = 0; + float width = 0; + float area = 0; + float aspectRatio = 0; + float mass = 0; + const int fabricWeight = 135; + float gravitationalPull = 0; + + length = GetLength(); + width = GetWidth(); + //CalcArea(length, width); + + + cout << endl << endl << "Length: " << length << endl; + cout << "Width: " << width << endl; + + area = (width * length) / 2; + area = area / 10000; + + cout << endl << "The area of you kite is " << area << " square meters." << endl; + + + aspectRatio = width / length; + + cout << "Your kite's aspect ratio is: " << aspectRatio << endl; + + if (aspectRatio > 1) + { + cout << endl << "WARNING: Aspect ratio is too high. A lower aspect ratio will provide greater stability. Consider increasing the kite's aspect ratio." << endl; + } + + mass = (area * fabricWeight) / 1000; + + cout << endl << "Your kite weighs " << mass << " kg."; + + gravitationalPull = mass * 9.8; + + cout << endl << "The gravitational pull on your kite is " << gravitationalPull << " N/kg" << endl; + + return 0; } +float GetLength() +{ + float length; + + cout << "Enter kite length in centimeters: "; + cin >> length; + while (length > 400) + { + cout << "Length is too large. Must be less than 400." << endl; + cout << "Enter kite length in centimeters: "; + cin >> length; + } + while (length < 1) + { + cout << "Length is too small. Must be greater than 1." << endl; + cout << "Enter kite length in centimeters: "; + cin >> length; + } + + return length; +} +float GetWidth() +{ + float width; + + cout << "Enter kite width in centimeters: "; + cin >> width; + + while (width > 400) + { + cout << "Width is too large. Must be less than 400." << endl; + cout << "Enter kite width in centimeters: "; + cin >> width; + } + while (width < 1) + { + cout << "Width is too small. Must be greater than 1." << endl; + cout << "Enter kite width in centimeters: "; + cin >> width; + } + + return width; +} +/* +float CalcArea(float length, float width) +{ + float area; + + cout << endl << endl << "Length: " << length << endl; + cout << "Width: " << width << endl; + + area = (width * length) / 2; + area = area / 10000; + + cout << endl << "The area of you kite is " << area << " square meters." << endl; + + return area; +} +*/ |