C++的写法:
#include
#include
using namespace std;
int main(){
double x=0.5;
double change=(x*exp(x)-1)/(x*exp(x)+exp(x));
while(fabs(change)>=1e-7){
x=x-change;
change=(x*exp(x)-1)/(x*exp(x)+exp(x));
}
cout
C++的写法:
#include
#include
using namespace std;
int main(){
double x=0.5;
double change=(x*exp(x)-1)/(x*exp(x)+exp(x));
while(fabs(change)>=1e-7){
x=x-change;
change=(x*exp(x)-1)/(x*exp(x)+exp(x));
}
cout