How to get PI value using std::numbers in C++

1 Answer

0 votes
#include <iostream>
#include <numbers>

int main()
{
    const long double pi = std::numbers::pi_v<long double>;
    
    std::cout << pi << std::endl;
}


 
/*
run:

3.14159

*/

 



answered Jun 5, 2024 by avibootz

Related questions

1 answer 125 views
1 answer 110 views
1 answer 90 views
2 answers 483 views
2 answers 892 views
...