Home > Back-end >  Small white help great god! E input accuracy, using Taylor formula for calculating the value of cosx
Small white help great god! E input accuracy, using Taylor formula for calculating the value of cosx

Time:09-29

Homework assignments... Online class I really too south
#include ;
Double funcos (double e, double x);
using namespace std;

Int main () {
Double e=0.001, a=0, x=1;
Double funcos (double e, double x);
//cout & lt; <"Please input accuracy requirement";
//cin & gt;> e;
//cout & lt; <"Please enter a number want that cosine";
//cin & gt;> x;
A=funcos (e, x);
Cout & lt; <"The number of cosine value is" & lt; return 0;
}

Double funcos (double e, double x)
{
Double r=0;
Double t=1;
Int I=1;
Do {
R +=t;
T=t * x * x/(2 * I - 2) * (2 * I - 3);
i++;
} while (fabs (t) & gt;=e);
Return r;
}
Debugging when no output... Even the "number of the cosine value of" the words are not 5555
Come and save the children...
  • Related