summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorMorgan Cyrus <[email protected]>2022-10-17 23:02:01 -0700
committerMorgan Cyrus <[email protected]>2022-10-17 23:02:01 -0700
commit6a0813e01e4b1b374205049584f45b7ac70014d0 (patch)
tree66b9273841c3bfa4ea08daa34ce488b4866de452 /BlankConsoleLab/BlankConsoleLab.cpp
parentAspect Ratio tested and working (diff)
downloadcst116-lab1-cyrus-6a0813e01e4b1b374205049584f45b7ac70014d0.tar.xz
cst116-lab1-cyrus-6a0813e01e4b1b374205049584f45b7ac70014d0.zip
adding comments to my code
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index a9d9a32..4846675 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -3,19 +3,7 @@
*
* Morgan Cyrus
* CST116_Lab1_Cyrus
-* Kite Lab
-*
-* Note: This has been put in order of completion. Do one step and then compile / check it.
-*
-* 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.
-*
-* Your output should be self-documenting. In other words, it should show the input with labels and then the output. You can see some examples of final outputs at the end.
+* Kite Lab
*/
#include <iostream>
@@ -40,9 +28,11 @@ int main()
cout << "\nYou have entered " << kiteWidth << "cm for kite width, and " << kiteLen << "cm for kite length." << endl;
+ //calculate the area of the kite and store in kiteArea
kiteArea = kiteCalc(kiteWidth, kiteLen);
cout << "The area of the kite, in square meters, is: " << kiteArea << endl;
+ //calculate the aspect ratio of the kite and spit out a message to the user if the aspect ratio is greater than or equal to 1
aspectCalc(kiteWidth, kiteLen);
}
@@ -59,6 +49,7 @@ float kiteCalc(float wid, float len)
float aspectCalc(float wid, float len)
{
+ // calculate the aspect ratio of the kite using input from the user in main()
float aspectRatioCalc = (wid / len);
if (aspectRatioCalc >= 1)