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
...