Thursday, November 15, 2012

Using the Constant PI in C++

In visual c++, you need to do the following in order to use the defined PI constant.

... 
#define _USE_MATH_DEFINES
#include < math.h > 

double EuclidFunctions::AreaOfCircle(double radius){
return (pow(radius,2)) * M_PI;
}


where 'M_PI' is the constant value.

Enjoy

1 comment:

Anonymous said...

thanks for sharing.