diff options
| -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; + } } |