summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan HarrisToovy <[email protected]>2021-10-15 13:09:37 -0700
committerJordan HarrisToovy <[email protected]>2021-10-15 13:09:37 -0700
commita22cb20d7d669f0be648fc24061ab687e1f2eece (patch)
tree7c5619ff56936515a6c15bccdb8a77913f07d22e
parentBase code finished (diff)
downloadcst116-proj1-jordanht-oit-a22cb20d7d669f0be648fc24061ab687e1f2eece.tar.xz
cst116-proj1-jordanht-oit-a22cb20d7d669f0be648fc24061ab687e1f2eece.zip
Added broken version
-rw-r--r--CST116F2021-Proj1/CST116 Project 1 BROKEN Harris-Toovy.cpp44
-rw-r--r--CST116F2021-Proj1/CST116 Project 1 Console output Harris-Toovy.txt43
2 files changed, 87 insertions, 0 deletions
diff --git a/CST116F2021-Proj1/CST116 Project 1 BROKEN Harris-Toovy.cpp b/CST116F2021-Proj1/CST116 Project 1 BROKEN Harris-Toovy.cpp
new file mode 100644
index 0000000..a10004e
--- /dev/null
+++ b/CST116F2021-Proj1/CST116 Project 1 BROKEN Harris-Toovy.cpp
@@ -0,0 +1,44 @@
+//Code by Jordan Harris-Toovy for OIT's CST116 course, October 2021
+
+/*
+* Pseudocode:
+* DISPLAY Prompt for radius
+* GET user input, put into variable radius
+*
+* DISPLAY Prompt for height
+* GET user input, put into variable height
+*
+* Calculate volume, put into variable volume
+* DISPLAY Prompt for volume
+*/
+
+#include <iostream>
+#include <iomanip>
+
+int main()
+{
+ float radius = 0.0F, height = 0.0F, volume = 0.0F, pi = 3.14159265359F;
+
+ //Get values from user
+ std::cout << "Cylinder volume calculator MK1\n" << "Enter the radius of the cylinder: ";
+ std::cin >> radius;
+
+ std::cout << "\nEnter the height of the cylinder: ";
+ std::cin >> height;
+
+ //Exit if either input is less then zero
+ if ((radius < 0) || (height < 0))
+ {
+ std::cout << "\nInvald input\n";
+ return (1);
+ }
+
+ //Calculate volume
+ volume = height * pi + radius * radius;
+
+ //Display the volume
+ std::cout.setf(std::ios::fixed);
+ std::cout << "\n\nThe volume of the cylinder is: " < std::setprecision(2) << volume << std::endl;
+
+ return (0);
+}
diff --git a/CST116F2021-Proj1/CST116 Project 1 Console output Harris-Toovy.txt b/CST116F2021-Proj1/CST116 Project 1 Console output Harris-Toovy.txt
new file mode 100644
index 0000000..6e990e5
--- /dev/null
+++ b/CST116F2021-Proj1/CST116 Project 1 Console output Harris-Toovy.txt
@@ -0,0 +1,43 @@
+This is a copy of the console output for the program:
+[Run 1]:
+
+Cylinder volume calculator MK1
+Enter the radius of the cylinder: 5
+
+Enter the height of the cylinder: 6
+
+
+The volume of the cylinder is: 471.24
+
+C:\Users\jorda\Source\Repos\cst116-proj1-JordanHT-OIT\CST116F2021-Proj1\Debug\CST116 Project 1 Harris-Toovy.exe (process 5296) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+[Run 2]:
+
+Cylinder volume calculator MK1
+Enter the radius of the cylinder: 3
+
+Enter the height of the cylinder: 8
+
+
+The volume of the cylinder is: 226.19
+
+C:\Users\jorda\Source\Repos\cst116-proj1-JordanHT-OIT\CST116F2021-Proj1\Debug\CST116 Project 1 Harris-Toovy.exe (process 5212) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+[Run 3]:
+
+Cylinder volume calculator MK1
+Enter the radius of the cylinder: 11
+
+Enter the height of the cylinder: -5
+
+Invald input
+
+C:\Users\jorda\Source\Repos\cst116-proj1-JordanHT-OIT\CST116F2021-Proj1\Debug\CST116 Project 1 Harris-Toovy.exe (process 5220) exited with code 1.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .