diff options
| author | Musa Ahmed <[email protected]> | 2022-10-06 15:05:11 -0700 |
|---|---|---|
| committer | Musa Ahmed <[email protected]> | 2022-10-06 15:05:11 -0700 |
| commit | db8991ff3910714ae86ae702062c19cea0e553d8 (patch) | |
| tree | c8e82f63e8ff3272c81f57e52ce8f2005e625182 | |
| parent | initial commit (diff) | |
| download | cst116-lab1-m005a-db8991ff3910714ae86ae702062c19cea0e553d8.tar.xz cst116-lab1-m005a-db8991ff3910714ae86ae702062c19cea0e553d8.zip | |
finished part 1
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ed5f807..15b9b78 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -11,6 +11,42 @@ using std::endl; int main() { - cout << "Hello World!\n"; + 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; + } + } + + } |