diff options
| author | TheOtherTonyStark <[email protected]> | 2022-10-19 22:19:15 -0700 |
|---|---|---|
| committer | TheOtherTonyStark <[email protected]> | 2022-10-19 22:19:15 -0700 |
| commit | 2b1f01b869cfa3e5547f56dbcaee6ae0a4433c42 (patch) | |
| tree | 2e4f32e5f1cb9be3e18003188acab75b47a37012 | |
| parent | Third Commit (diff) | |
| download | cst116-lab1-theothertonystark-2b1f01b869cfa3e5547f56dbcaee6ae0a4433c42.tar.xz cst116-lab1-theothertonystark-2b1f01b869cfa3e5547f56dbcaee6ae0a4433c42.zip | |
| -rw-r--r-- | BlankConsoleLab/CST116-Lab1-Chambers.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/BlankConsoleLab/CST116-Lab1-Chambers.cpp b/BlankConsoleLab/CST116-Lab1-Chambers.cpp index 0186f4a..23db280 100644 --- a/BlankConsoleLab/CST116-Lab1-Chambers.cpp +++ b/BlankConsoleLab/CST116-Lab1-Chambers.cpp @@ -11,19 +11,11 @@ using std::cin; using std::endl; using std::setprecision; -//Ask the user for the width and length in centimeters. -//Print what the user entered for the width and length. -//Compute the area of the kite.Area = (width � length) / 2 -//Convert the square centimeters to square meters by dividing by 10000. -//Print area in square meters.Note: square meters will use decimals. -//Compute the aspect ratio of the kite.The aspect ratio is width / length -//If the aspect ratio is greater than or equal to 1, print a warning message that a lower aspect ratio would provide more stability. - -int width; -int length; -int area; -int sqmarea; -int aspectratio; +float width; +float length; +float area; +float sqmarea; +float aspectratio; int main() { @@ -36,15 +28,21 @@ int main() cout << "Our kite has a width of " << width << " and a length of " << length << " both measured in cm." << endl; - int area = width * length; + float area = width * length; cout << " Our kite has an area of " << area << " in cm^2." << endl; - int sqmarea = area / 10000; + float sqmarea = area / 10000; cout << " Our area in square meters is " << sqmarea << endl; + float aspectratio = width / length; + cout << fixed << setprecision(2) << " Our kite has an aspect ratio of " << aspectratio << endl; + if (aspectratio >= 1) + { + cout << "A lower aspect ratio my result in better stability in our kite" << endl; + } } |