看看这题c++算π怎么算?4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))m(i) = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))Write a function that returns m(n) with the following function head.double pi(int n)提示You should subm
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/02 22:23:47
看看这题c++算π怎么算?4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))m(i) = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))Write a function that returns m(n) with the following function head.double pi(int n)提示You should subm
看看这题c++算π怎么算?4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))
m(i) = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))
Write a function that returns m(n) with the following function head.
double pi(int n)
提示
You should submit the implementation of the function but do not submit the main() function.
看看这题c++算π怎么算?4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))m(i) = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ...-1/(2n-1) + 1/(2n+1))Write a function that returns m(n) with the following function head.double pi(int n)提示You should subm
#include
#include
double pi(int n)
{
\x09double sum = 1;
\x09for(int i = 1;i