diff options
| author | Andrei F <[email protected]> | 2022-10-19 21:47:11 -0700 |
|---|---|---|
| committer | Andrei F <[email protected]> | 2022-10-19 21:47:11 -0700 |
| commit | 95b9f255d543e19c77fabfb5d99ed4bb8482274e (patch) | |
| tree | cde830f80e2866afc5d968a9b9b5f68de62a2376 | |
| parent | Finished steps 3-7 (diff) | |
| download | cst116-lab1-florea-95b9f255d543e19c77fabfb5d99ed4bb8482274e.tar.xz cst116-lab1-florea-95b9f255d543e19c77fabfb5d99ed4bb8482274e.zip | |
Finished part 1
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 26 | ||||
| -rw-r--r-- | output_part1_florea.txt | 9 | ||||
| -rw-r--r-- | output_part2_florea.txt | 0 |
3 files changed, 28 insertions, 7 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index c9deecf..29fa885 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -17,24 +17,36 @@ using std::endl; int main() { - float width, length, area, ratio; + float width = 0; + float length = 0; + float area, ratio; - cout << "Please enter the WIDTH of your kite in centimeters (decimals are OK): "; - cin >> width; - cout << "Please enter the LENGTH of your kite in centimeters (decimals are OK): "; - cin >> length; + while(!(width <= 400 && width >= 1 && length <= 400 && length >= 1)) { + cout << "Please only enter WIDTH and LENGTH between 1 - 400" << endl; - cout << "Width: " << width << " | Length: " << length << endl; + cout << "Please enter the WIDTH of your kite in centimeters (decimals are OK): "; + cin >> width; + + cout << "Please enter the LENGTH of your kite in centimeters (decimals are OK): "; + cin >> length; + } + cout << "Width: " << width << " CM" <<" | Length: " << length << " CM" << endl; area = (width * length) / 2; area /= 10000; + cout << "Area (in square meters): " << area << " M^2" << endl; + const float mass = 135 * area; + cout << "If your kite is using a medium weight fabric, it is calculated to weigh: " << mass << " grams/meter^2" + << endl; + + ratio = width / length; if(ratio >= 1){ cout << "Warning: a lower aspect ratio would provide more stability." << endl; - cout << "Current aspect ratio (width / length): " << ratio << endl; + cout << "Current aspect ratio: " << ratio << " (width / length)"<< endl; } } diff --git a/output_part1_florea.txt b/output_part1_florea.txt new file mode 100644 index 0000000..18c8183 --- /dev/null +++ b/output_part1_florea.txt @@ -0,0 +1,9 @@ +/Users/andreiflorea/Desktop/Code/Oregon_Tech/cst116-lab1-florea/cmake-build-debug/cst116_lab1_florea +Please enter the WIDTH of your kite in centimeters (decimals are OK): 25 +Please enter the LENGTH of your kite in centimeters (decimals are OK): 25 +Width: 25 CM | Length: 25 CM +Area (in square meters): 0.03125 M^2 +Warning: a lower aspect ratio would provide more stability. +Current aspect ratio: 1 (width / length) + +Process finished with exit code 0
\ No newline at end of file diff --git a/output_part2_florea.txt b/output_part2_florea.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/output_part2_florea.txt |