aboutsummaryrefslogtreecommitdiff
path: root/CST116_Project1_HernandezJimenez_BROKEN.cpp
diff options
context:
space:
mode:
authorBensProgramma <[email protected]>2021-10-15 22:01:37 -0700
committerGitHub <[email protected]>2021-10-15 22:01:37 -0700
commit06f9af5f0f50b7f6dc19da0da7941e7a06027024 (patch)
treed7aa2b47b93b158a7e078823909640c83804f039 /CST116_Project1_HernandezJimenez_BROKEN.cpp
parentInitial commit (diff)
downloadcst116-proj1-bensprogramma-06f9af5f0f50b7f6dc19da0da7941e7a06027024.tar.xz
cst116-proj1-bensprogramma-06f9af5f0f50b7f6dc19da0da7941e7a06027024.zip
Add files via upload
-The CST116_Project1_Schroeder.cpp file is my WORKING copy of the program (Documentation included in comments section of the program) -The CST116_Project1_Schroeder_workingRun.txt file is the text output for my working program -The CST116_Project1_BROKEN_Schroeder.cpp is a copy of my program with a Syntax Error and a Logic Error included in the code. -The CST116_Project1_HernandezJimenez_BROKEN.cpp file is Freddy's program with my corrections (note: A new project with Freddy's original code copied into it was needed to get the code from Freddy's Mac computer IDE to work in Visual Studio)
Diffstat (limited to 'CST116_Project1_HernandezJimenez_BROKEN.cpp')
-rw-r--r--CST116_Project1_HernandezJimenez_BROKEN.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/CST116_Project1_HernandezJimenez_BROKEN.cpp b/CST116_Project1_HernandezJimenez_BROKEN.cpp
new file mode 100644
index 0000000..729fd5b
--- /dev/null
+++ b/CST116_Project1_HernandezJimenez_BROKEN.cpp
@@ -0,0 +1,37 @@
+// CST116_Project1_HernandezJimenez_BROKEN.cpp : This file contains the 'main' function. Program execution begins and ends there.
+// **** Original program submitted by Frederico HernandezJimenez with errors 10/15/2021 7:58pm
+// **** This program was edited by Benjamin Schroeder 10/15/2021 8:34pm
+
+
+
+#include <iostream>
+//#define PI = 3.14; // This seems incorrect Syntax Error ...note: BAS 10/15/2021
+using namespace std;
+
+
+int main()
+{
+ //int volume = 0; // These should probably all be a float type ...note:BAS
+ float volume = 0.0; // to accept the value of PI ...note:BAS
+ //int Radius = 0;
+ float Radius = 0.0;
+ //int Height = 0;
+ float Height = 0.0;
+ float PI = 3.14; // Added this variable to incorporate PI, because the #define statement above didn't work ...note: BAS
+
+
+ cout << "Enter Radius: ";
+ cin >> Radius;
+
+ cout << "Enter Height: ";
+ cin >> Height;
+
+ //volume = 3.14 * Radius * Height; // incorrect logic expression for the volume of a cylinder ... note: BAS
+ volume = PI * Radius * Radius * Height; // Replaced the line above to give the correct expression ... note: BAS
+
+ cout << "The volume of the cylinder is approximately: " << volume << std::endl;
+
+
+ return 0;
+
+}