summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorCEOofOogaBooga <[email protected]>2022-10-18 20:03:38 -0700
committerCEOofOogaBooga <[email protected]>2022-10-18 20:03:38 -0700
commit7aac0c720254726b50eeff4419f3692eb217078c (patch)
treee6a6043dfcca112a952eb6ef269a673fa605ead1 /BlankConsoleLab/BlankConsoleLab.cpp
parentWidth size done (diff)
downloadcst116-lab1--trinh--7aac0c720254726b50eeff4419f3692eb217078c.tar.xz
cst116-lab1--trinh--7aac0c720254726b50eeff4419f3692eb217078c.zip
Test of Gravity and Mass
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index b487b33..60facc6 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -13,6 +13,8 @@ float width = 0;
float length = 0;
float area = 0;
float ratio = 0;
+float mass = 0;
+float gravitational_pull = 0;
int main()
{
while (width > 400 || 1 > width)
@@ -22,14 +24,24 @@ int main()
if (width > 400 || 1 > width)
cout << "Number cannot be greater than 400 or less than 1" << endl;
};
- cout << "Enter length in cm: ";
- cin >> length;
+ while (length > 400 || 1 > length)
+ {
+ cout << "Enter length in cm: ";
+ cin >> length;
+ if (length > 400 || 1 > length)
+ cout << "Number cannot be greater than 400 or less than 1" << endl;
+ };
area = ((length * width)/2.0)/10000.0;
cout << "Area in square meters: " << area << endl;
ratio = width / length;
- cout << "Ratio: " << ratio << endl;
+ cout << "Ratio: " << ratio << endl;
if (ratio >= 1)
- cout << "Warning: use a lower ratio for stability" << endl;
+ cout << "Warning: use a lower ratio for stability" << endl;
+ mass = (area * 135) / 1000;
+ output << "Mass in kg: " << mass << endl;
+ gravitational_pull = mass * 9.8;
+ output << "Gravitational pull is: " << gravitational_pull << endl;
+