Wickedgood
3
Q:

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;
}
1
double pi = 2*acos(0.0);
1
const float pi = 2 * acos(0.0f);
0

New to Communities?

Join the community