diff options
| author | Joe Traver <[email protected]> | 2022-10-18 21:18:35 -0700 |
|---|---|---|
| committer | Joe Traver <[email protected]> | 2022-10-18 21:18:35 -0700 |
| commit | a714e5261b118d58d745712bebfda4205c51b361 (patch) | |
| tree | 396a03c3db245bd20653ecca76939b1d530a4f42 | |
| parent | Stage 7 Complete (diff) | |
| download | cst116-lab1-joetraver30-a714e5261b118d58d745712bebfda4205c51b361.tar.xz cst116-lab1-joetraver30-a714e5261b118d58d745712bebfda4205c51b361.zip | |
Part 1 Finished. Changed width var to float to accommodate tiny kites that have a ratio of less than 1 to initate the WARNING
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 82b9c16..ac5d528 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -12,40 +12,42 @@ using std::endl; int main() { int length; - int width; + float width; float area; float meters; float ratio; cout << "Enter Length of kite in cm: "; - cin >> length; + cin >> length; - cout << "Enter width of kite in cm: "; - cin >> width; + cout << "Enter Width of kite in cm: "; + cin >> width; - cout << "Length = " << length << " cm" << endl; + cout << "Length = " << length << " cm" << endl; + + cout << "Width = " << width << " cm" << endl; + - cout << "Width = " << width << " cm" << endl; - // area calculation - area = (length * width) / 2; + area = (length * width) / 2; // unit conversion - meters = area / 10000; + meters = area / 10000; - cout << "Kite area: " << meters << " square meters" << endl; + cout << "Kite area: " << meters << " square meters" << endl; // aspect ratio - ratio = width / length; + ratio = width / length; if (ratio > 1) - cout << "WARNING! A lower aspect ratio would provide more stability" << endl; + cout << "WARNING! A lower aspect ratio would provide more stability" << endl; return 0; + } |