summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan HarrisToovy <[email protected]>2021-10-15 13:41:18 -0700
committerJordan HarrisToovy <[email protected]>2021-10-15 13:41:18 -0700
commit8c120f0dd435ac1aff31a11e916e6d1e2c1d6fcc (patch)
treebcfd3fda4154a5f8c1555ce1dc844831b5b8c606
parentAdded broken version (diff)
downloadcst116-proj1-jordanht-oit-8c120f0dd435ac1aff31a11e916e6d1e2c1d6fcc.tar.xz
cst116-proj1-jordanht-oit-8c120f0dd435ac1aff31a11e916e6d1e2c1d6fcc.zip
Fixed Jacob Knox's code sample
-rw-r--r--CST116F2021-Proj1/Jacob Knox's code/BrokenCode-Fixed Console output.txt8
-rw-r--r--CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp22
2 files changed, 30 insertions, 0 deletions
diff --git a/CST116F2021-Proj1/Jacob Knox's code/BrokenCode-Fixed Console output.txt b/CST116F2021-Proj1/Jacob Knox's code/BrokenCode-Fixed Console output.txt
new file mode 100644
index 0000000..dc89dbb
--- /dev/null
+++ b/CST116F2021-Proj1/Jacob Knox's code/BrokenCode-Fixed Console output.txt
@@ -0,0 +1,8 @@
+Console output for BrokenCode.cpp after fixes were applied:
+
+Input the cylinder's radius: 5
+Input the cylinder's height: 6
+The volume of a cyliner with radius: 5.000, and height: 6.000, is 471.300
+C:\Users\jorda\source\repos\CST_Testing\Debug\CST_Testing.exe (process 6388) 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 . . . \ No newline at end of file
diff --git a/CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp b/CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp
new file mode 100644
index 0000000..4b2e000
--- /dev/null
+++ b/CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp
@@ -0,0 +1,22 @@
+//Original code by Jacob Knox. Modified by Jordan Harris-Toovy
+
+// BrokenCode.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//This file has one logic and one syntax error
+
+#include <iostream>
+using namespace std;
+
+int main()
+{
+ const double PI = 3.142;
+ double radius, height, volume;
+
+ cout << "Input the cylinder's radius: ";
+ cin >> radius;
+ cout << "Input the cylinder's height: ";
+ cin >> height;
+
+ volume = radius * radius * PI * height; //Fixed issue where radius was multiplied three times
+ cout.precision(3);
+ cout << fixed << "The volume of a cyliner with radius: " << radius << ", and height: " << height << ", is " << volume; //Fixed issue where + was used instad of <<
+}