summaryrefslogtreecommitdiff
path: root/CST116-Lab1-Bold.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116-Lab1-Bold.cpp')
-rw-r--r--CST116-Lab1-Bold.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/CST116-Lab1-Bold.cpp b/CST116-Lab1-Bold.cpp
new file mode 100644
index 0000000..4b9c4ba
--- /dev/null
+++ b/CST116-Lab1-Bold.cpp
@@ -0,0 +1,49 @@
+#include <iostream>
+
+using namespace std;
+
+using std::cout;
+using std::cin;
+using std::endl;
+
+int main()
+{
+ float width = 0;
+ float length = 0;
+ float area = 0;
+ float aspect_ratio = 0;
+ const float fabric = 135; // 135 gram per meter
+ float grav = 0; // gravitation
+
+ while (width < 1 || width > 400) //I used while for the range of 1 to 400
+ {
+ cout << "Enter the width in centimeters between 1 and 400 : ";
+ cin >> width;
+
+ }
+
+ while (length < 1 || length > 400) //I used while for the length range as well. It will loop untill correct number entered.
+ {
+ cout << "Enter the length in centimeters between 1 and 400 : ";
+ cin >> length;
+
+ }
+
+ cout << "\n\nYour width is " << width << " and " << "length is " << length << " centimeters.\n\n";
+
+ area = (((width * length) / 2) / 10000); //Calculating total area here.
+ grav = area * fabric; //Calculating gravitational pull.
+
+ aspect_ratio = width / length; //Calcualting the aspect of ratio
+
+ cout << "Total area: " << area << " square meters." <<"\nGravitational pull: " << grav <<" gr.\n";
+ cout << "The aspect ratio: " << aspect_ratio;
+
+ if (aspect_ratio >= 1) // I used if statement
+ cout << "\nA lower aspect ratio provides more stability. \n\n";
+
+ else cout << "\nThe aspect of ratio is good. \n\n";
+
+ return 0;
+}
+