summaryrefslogtreecommitdiff
path: root/CST116F2021-Proj1/CST116F2021-Proj1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116F2021-Proj1/CST116F2021-Proj1.cpp')
-rw-r--r--CST116F2021-Proj1/CST116F2021-Proj1.cpp24
1 files changed, 13 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;
+}