//Chapter 3 Exercise 1 Program //Header Files #include <iostream> using namespac
ID: 3649133 • Letter: #
Question
//Chapter 3 Exercise 1 Program//Header Files
#include <iostream>
using namespace std;
//Declaring constant
const double PI = 3.14159;
//Declaring variables for the cone
float diameter,radius,height;
float volume;
int main ()
{
//Now we input the diameter from the console
cout<< "Please enter the diameter of the cone.";
cin>> diameter;
//Now we input the height from the console
cout<< "Please enter the height of the cone.";
cin>> height;
//Now we find the radius by dividing the diameter of the cone by 2
radius = diameter/2;
//Now we calculate the volume with the following formula: 1/3 * PI * R * R * Height
volume = ((1/3) PI * (radius * radius * height));
//Now we can display the calculated volume of the cone on the console
cout<<" The Volume of the cone is:" <<volume<<endl;
//Used to pause the console display so we can see the calculated value
system ("pause");
return 0;
}