#include
#include
double mycos(double x1)
{
double x0 = x1;
x1 = cos(x0);
if (abs(x1 - x0) < 0.000001)
{
mycos(x1);
}
else
{
return x1;
}
}
int main()
{
double x1 = 0.0;
printf("%f",mycos(x1));
return 0;
}
求得x=1.000000
#include
#include
double mycos(double x1)
{
double x0 = x1;
x1 = cos(x0);
if (abs(x1 - x0) < 0.000001)
{
mycos(x1);
}
else
{
return x1;
}
}
int main()
{
double x1 = 0.0;
printf("%f",mycos(x1));
return 0;
}
求得x=1.000000