Check out example codes for "pi in c++". It will help you in understanding the concepts better.

Code Example 1

#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;
}

Code Example 2

double pi = 2*acos(0.0);

Code Example 3

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

Learn ReactJs, React Native from akashmittal.com