Today We Calculating the Volume of a Cylinder. Find the radius of the circular base. Either circle will do since they are the same size. Calculate the area of the circular base.
C++ program to find volume of cube, cylinder, sphere by function overloading
#include<iostream>
#include<conio.h>
using namespace std;
main()
{
float r,h,volume;
const float pi=3.1417;
cout<<"Enter the value of radius of the cylinder:";
cin>>r;
cout<<"Enter the value of height of the cylinder:";
cin>>h;
volume=pi*r*r*h;
cout<<"Volume of the cylinder is="<<volume;
getch();
}
Output of Program
Enter the value of radius of the cylinder:40 Enter the value of height of the cylinder:25 Volume of the cylinder is=125668