Answers for "pi in c++"

C++
5

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;
}
Posted by: Guest on September-16-2020
0

c++ pi float

const float pi = 2 * acos(0.0f);
Posted by: Guest on July-11-2020
0

long pi in c++

typedef long double ld;
const ld pi = 3.1415926535897932384626433832795;
Posted by: Guest on December-26-2020

Browse Popular Code Answers by Language