diff options
| author | Jordan HarrisToovy <[email protected]> | 2021-10-15 13:41:18 -0700 |
|---|---|---|
| committer | Jordan HarrisToovy <[email protected]> | 2021-10-15 13:41:18 -0700 |
| commit | 8c120f0dd435ac1aff31a11e916e6d1e2c1d6fcc (patch) | |
| tree | bcfd3fda4154a5f8c1555ce1dc844831b5b8c606 /CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp | |
| parent | Added broken version (diff) | |
| download | cst116-proj1-jordanht-oit-8c120f0dd435ac1aff31a11e916e6d1e2c1d6fcc.tar.xz cst116-proj1-jordanht-oit-8c120f0dd435ac1aff31a11e916e6d1e2c1d6fcc.zip | |
Fixed Jacob Knox's code sample
Diffstat (limited to 'CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp')
| -rw-r--r-- | CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp b/CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp new file mode 100644 index 0000000..4b2e000 --- /dev/null +++ b/CST116F2021-Proj1/Jacob Knox's code/BrokenCode.cpp @@ -0,0 +1,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 << +} |