00001 #include "volume.h" 00002 00007 #include <math/real.h> 00008 00009 double sphereVolume(const double radius) 00010 { 00011 return (4.0/3.0)*M_PI*radius*radius*radius; 00012 } 00013 00014 double cylinderVolume(const double radius,const double height) 00015 { 00016 return M_PI*radius*radius*height; 00017 } 00018 00019 double coneVolume(const double radius,const double height) 00020 { 00021 return (1.0/3.0)*M_PI*radius*radius*height; 00022 } 00023 00024 double boxVolume(const double width,const double height,const double depth) 00025 { 00026 return width*height*depth; 00027 }