#include
#include
using namespace std ;
int main ()
{
int n;
double x,i,j,k,m,s;
n=1;
cout<<"输入一个数x,x的范围是[0.1,0.7]"<<'\n';
cin>>x;
while(fabs(m)>=1e-7)
{
i=(-1)^n*n*(2*n-1)*x^(2*n+1);
j=n*2*n*(2*n+1);
m=i/j;
s=x+m;
m++;}
cout<<"arcsh(x)的值是"<<'\n';
return 0;
}
C++中,^是位运算异或,而不是乘方。如果你想用乘方,请在代码前插入:
#include <cmath>
这是乘方:
pow(底数,指数);
c++中的"^"符号 不是数学中的乘方符号