summaryrefslogtreecommitdiff
path: root/CST116F2021-Proj1/CST116F2021-Proj1.cpp
blob: c3ab1bd341eec9591acb9e1cb23e06b4d2c72b03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()
{
    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;
    cout.precision(3);
    cout << fixed << "The volume of a cyliner with radius: " << radius << ", and height: " << height << ", is " << volume;
}