summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacobAKnox <[email protected]>2021-10-10 21:54:27 -0700
committerJacobAKnox <[email protected]>2021-10-10 21:54:27 -0700
commit47ab286682df059c66aa3f9c5f739e848b069ba3 (patch)
tree373d2894c39ddf2c397008062df01a611758a6cb
parentInitial commit (diff)
downloadcst116-proj1-jacobaknox-47ab286682df059c66aa3f9c5f739e848b069ba3.tar.xz
cst116-proj1-jacobaknox-47ab286682df059c66aa3f9c5f739e848b069ba3.zip
Working version
-rw-r--r--CST116F2021-Proj1/CST116F2021-Proj1.cpp24
-rw-r--r--PsudoCode.txt5
-rw-r--r--Run.txt6
3 files changed, 24 insertions, 11 deletions
diff --git a/CST116F2021-Proj1/CST116F2021-Proj1.cpp b/CST116F2021-Proj1/CST116F2021-Proj1.cpp
index 8bcb373..c3ab1bd 100644
--- a/CST116F2021-Proj1/CST116F2021-Proj1.cpp
+++ b/CST116F2021-Proj1/CST116F2021-Proj1.cpp
@@ -1,20 +1,22 @@
// CST116F2021-Proj1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
+//This program takes a radius and height input from the user and calculates the volume of a cylinder with those parameters
+
#include <iostream>
+using namespace std;
int main()
{
- std::cout << "Hello World!\n";
-}
+ const double PI = 3.142;
+ double radius, height, volume;
-// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
-// Debug program: F5 or Debug > Start Debugging menu
+ cout << "Input the cylinder's radius: ";
+ cin >> radius;
+ cout << "Input the cylinder's height: ";
+ cin >> height;
-// Tips for Getting Started:
-// 1. Use the Solution Explorer window to add/manage files
-// 2. Use the Team Explorer window to connect to source control
-// 3. Use the Output window to see build output and other messages
-// 4. Use the Error List window to view errors
-// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
-// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
+ volume = radius * radius * PI * height;
+ cout.precision(3);
+ cout << fixed << "The volume of a cyliner with radius: " << radius << ", and height: " << height << ", is " << volume;
+}
diff --git a/PsudoCode.txt b/PsudoCode.txt
new file mode 100644
index 0000000..75b7487
--- /dev/null
+++ b/PsudoCode.txt
@@ -0,0 +1,5 @@
+radius = getradius
+height = getheight
+pi = 3.141
+v = r * r * pi * height
+output volume \ No newline at end of file
diff --git a/Run.txt b/Run.txt
new file mode 100644
index 0000000..eb3ad26
--- /dev/null
+++ b/Run.txt
@@ -0,0 +1,6 @@
+Run:
+Input the cylinder's radius: 10
+Input the cylinder's height: 5
+The volume of a cyliner with radius: 10.000, and height: 5.000, is 1571.000
+C:\Users\jakno\source\repos\CST116\project1\x64\Debug\CST116F2021-Proj1.exe (process 20268) exited with code 0.
+Press any key to close this window . . .