summaryrefslogtreecommitdiffstats
path: root/C++/cubeSwitch
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
committermsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
commit9d53d8857eaa1c9405894a88ca75bc4657e42f35 (patch)
treeeb1efc1d028b949dd83bb710c68be8eff58f26e7 /C++/cubeSwitch
downloadschool-code-master.tar.gz
school-code-master.tar.bz2
school-code-master.zip
Inital CommitHEADmaster
Diffstat (limited to 'C++/cubeSwitch')
-rw-r--r--C++/cubeSwitch/Ch 4 Cube program instructions.docxbin0 -> 28802 bytes
-rw-r--r--C++/cubeSwitch/cubeSwitch.cpp95
2 files changed, 95 insertions, 0 deletions
diff --git a/C++/cubeSwitch/Ch 4 Cube program instructions.docx b/C++/cubeSwitch/Ch 4 Cube program instructions.docx
new file mode 100644
index 0000000..f59110d
--- /dev/null
+++ b/C++/cubeSwitch/Ch 4 Cube program instructions.docx
Binary files differ
diff --git a/C++/cubeSwitch/cubeSwitch.cpp b/C++/cubeSwitch/cubeSwitch.cpp
new file mode 100644
index 0000000..eef0dd6
--- /dev/null
+++ b/C++/cubeSwitch/cubeSwitch.cpp
@@ -0,0 +1,95 @@
+// Your Name
+// Date:
+// Program Title:
+// Program Description:
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <cmath>
+
+using namespace std;
+
+// Named constants
+
+int main()
+{
+
+ // Variable declaration
+ float sideLength;
+ int choice;
+
+ //Program title and description for the user
+
+ cout << "MENU TEMPLATE with SWITCH CASE" << endl << endl;
+
+ // User input
+
+ cout << "Choose the corresponding number for what task you want to complete." << endl;
+ cout << "1 - perimeter of one side " << endl;
+ cout << "2 - surface area of one side" << endl;
+ cout << "3 - surface area of the entire box" << endl;
+ cout << "4 - volume of the box." << endl;
+ cout << "Enter selected number here: ";
+ cin >> choice;
+
+ // Calculations
+
+ // Output to the screen
+
+ switch (choice)
+ {
+ case 1:
+
+ cout << "Perform task #1 : Perimeter of one side" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Side Perimeter Is: " << 4*sideLength << " Cubed Inches \n";
+ break;
+
+ case 2:
+ cout << "Perform task #2 : Surface area of one side" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Side Area Is: " << pow(sideLength, 2) << " Cubed Inches \n";
+ break;
+
+ case 3:
+ cout << "Perform task #3 : Surface area of the entire box" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Cube Surface Area Is: " << 6*pow(sideLength, 2) << " Cubed Inches \n";
+ break;
+
+ case 4:
+ cout << "Perform task #4 : Volume of the box" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Cube Volume Is: " << pow(sideLength, 3) << " Cubed Inches \n";
+
+ return 0;
+
+
+ break;
+
+ default:
+ cout << "Input error; program is terminating" << endl;
+ }
+ return 0;
+}