blob: 15df22a9482bc33d48e87b447c60f2c2bcfa5a9a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// CST116_Project1_HernandezJimenez_BROKEN.cpp : This file contains the 'main' function. Program execution begins and ends there.
// **** Original program submitted by Federico "Freddy" HernandezJimenez with errors 10/15/2021 7:58pm
//
//
// **** This program was edited by Benjamin Schroeder 10/15/2021 8:34pm
// **** - Original code arrived to Schroeder as a .cp file created in XCode whose text was then was copied to this Visual Studio Project
// **** - The incorrect code has been commented out with a corrected line entered below the incorrect line
// **** - Edits have been notated with initials BAS
#include <iostream>
//#define PI = 3.14; // This seems incorrect Syntax Error ...note: BAS 10/15/2021
using namespace std;
int main()
{
//int volume = 0; // These should probably all be a float type ...note:BAS
float volume = 0.0; // to work with the float value of PI ...note:BAS
//int Radius = 0;
float Radius = 0.0;
//int Height = 0;
float Height = 0.0;
float PI = 3.14; // Added this variable to incorporate PI, because the #define statement above didn't work ...note: BAS
cout << "Enter Radius: ";
cin >> Radius;
cout << "Enter Height: ";
cin >> Height;
//volume = 3.14 * Radius * Height; // Logic Error incorrect logic expression for the volume of a cylinder ... note: BAS
volume = PI * Radius * Radius * Height; // Replaced the line above to give the correct expression ... note: BAS
cout << "The volume of the cylinder is approximately: " << volume << std::endl;
return 0;
}
|