summaryrefslogtreecommitdiff
path: root/CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp
blob: 4b2e000055912bfd5ac5971fe09f764ab6267ba7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Original code by Jacob Knox. Modified by Jordan Harris-Toovy

// BrokenCode.cpp : This file contains the 'main' function. Program execution begins and ends there.
//This file has one logic and one syntax error

#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; //Fixed issue where radius was multiplied three times
    cout.precision(3);
    cout << fixed << "The volume of a cyliner with radius: " << radius << ", and height: " << height << ", is " << volume; //Fixed issue where + was used instad of <<
}