why i cant get the answer?its different from what i calculate with the calculator...help me please...
/this program use to calculate the volume of the given shapes
#include<iostream>
#include<conio>
main()
{
float num, capsule, cone, cylinder, hemisphere, pyramid, length, height, radius;
const float pi=3.142;
cout<<"Please select your shape by entering the number"<<endl;
cout<<"1. Capsule"<<endl<<"2. Cone"<<endl<<"3. Cylinder"<<endl<<"4. Hemisphere"<<endl<<"5. Pyramid"<<endl;
cout<<"The number you have selected is ";
cin>>num;
if (num==1)
{
cout<<"Please enter the radius : ";
cin>>radius;
cout<<"Please enter the side length : ";
cin>>length;
capsule=(pi*(radius*radius)*((4/3)*radius+length));
cout<<"The volume of the capsule is "<<capsule<<endl;
}
else if (num==2)
{
cout<<"Please enter the radius : ";
cin>>radius;
cout<<"Please enter the height : ";
cin>>height;
cone=(1/3)*(pi*(radius*radius)*height);
cout<<"The volume of the cone is "<<cone<<endl;
}
else if (num==3)
{
cout<<"Please enter the radius : ";
cin>>radius;
cout<<"Please enter the height : ";
cin>>height;
cylinder=(pi*(radius*radius)*height);
cout<<"The volume of the cylinder is "<<cylinder<<endl;
}
else if (num==4)
{
cout<<"Please enter the radius : ";
cin>>radius;
hemisphere=((2/3)*pi*(radius*radius*radius));
cout<<"The volume of the hemisphere is "<<hemisphere<<endl;
}
else if (num==5)
{
cout<<"Please enter the length : ";
cin>>length;
cout<<"Please enter the height : ";
cin>>height;
pyramid=((1/3)*(length*length)*height);
cout<<"The volume of the pyramid is "<<pyramid<<endl;
}
else
{
cout<<"The number you have entered is not in the list"<<endl;
}
getch();
return 0;
}