diff options
| author | Jordan HarrisToovy <[email protected]> | 2021-10-18 02:26:32 -0700 |
|---|---|---|
| committer | Jordan HarrisToovy <[email protected]> | 2021-10-18 02:26:32 -0700 |
| commit | 21e4caa4564b65ec52bb280a158bf3ab5b49dc60 (patch) | |
| tree | db8054c749426327597d6fb00cc9aef753d0b61f | |
| parent | Extended proof-of-functionality for working code (diff) | |
| download | cst116-proj1-jordanht-oit-master.tar.xz cst116-proj1-jordanht-oit-master.zip | |
2 files changed, 45 insertions, 0 deletions
diff --git a/CST116F2021-Proj1/Rayyan Ansari's code/Project1 - CST 116 - Rayyan Ansari-Fixed Console output.txt b/CST116F2021-Proj1/Rayyan Ansari's code/Project1 - CST 116 - Rayyan Ansari-Fixed Console output.txt new file mode 100644 index 0000000..e5dffce --- /dev/null +++ b/CST116F2021-Proj1/Rayyan Ansari's code/Project1 - CST 116 - Rayyan Ansari-Fixed Console output.txt @@ -0,0 +1,10 @@ +Console output for Project1 - CST 116 - Rayyan Ansari.cpp after fixes were applied: + +Please enter the radius of the Cylinder: 3 + +Please enter the height of the Cylinder: 5 + +The volume of a cylinder with height 5 and radius 3 is 141.372 +C:\Users\jorda\source\repos\CST_Testing\Debug\CST_Testing.exe (process 3252) 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 . . . diff --git a/CST116F2021-Proj1/Rayyan Ansari's code/Project1 - CST 116 - Rayyan Ansari.cpp b/CST116F2021-Proj1/Rayyan Ansari's code/Project1 - CST 116 - Rayyan Ansari.cpp new file mode 100644 index 0000000..e8eec4d --- /dev/null +++ b/CST116F2021-Proj1/Rayyan Ansari's code/Project1 - CST 116 - Rayyan Ansari.cpp @@ -0,0 +1,35 @@ +//Code by Rayyan Ansari, modified by Jordan Harris-Toovy, October 2021 + +#include <iostream> +#include <iomanip> +using namespace std; +using std::ios; + +int main() +{ + float radius; + float height; + float pi = 3.14159265; + float volume; + + cout << "Please enter the radius of the Cylinder: "; + cin >> radius; //Fixed missmatched variables + cout << endl; + + cout << "Please enter the height of the Cylinder: "; + cin >> height; //Fixed missmatched variables + cout << endl; + + volume = radius * radius * pi * height; + + if (volume > 0) { + cout << "The volume of a cylinder with height " << height << " and radius " << radius << " is "; + + cout.setf(ios::fixed); //Fixed missing colon + cout << setprecision(3) << volume; + } + + else { + cout << "Volume cannot be negative"; + } +}
\ No newline at end of file |