Pi In C++ Cmath Code Example


Example 1: pi in c++

#define _USE_MATH_DEFINES // must include this!   #include <cmath> #include <iostream>   int main() {    // M_PI = 3.14159265358979323846;   std::cout << M_PI << " " << M_E << " " << M_SQRT2 << endl;   return 0; }

Example 2: c++ pi float

const float pi = 2 * acos(0.0f);

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable