有请各位帮帮忙啊...真的很急...
急求个三角函数的编程...就是sin(x)=..........就是(-1)的i次方再乘以x的(2i+1)次方..最后除以(2i+1)的阶乘....谢谢了..我要交给老师的..作业来的 #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
cout<<setprecision(15);
cout<<"input x=";
double x;
cin>>x;
cout<<"input required precision:";
double prec;
cin>>prec;
double precp=1e100;
int i=0;
double result=0;
do
{
double temp=1;
for(int j=1;j<=(i+i+1);j++)
{
temp*=x/j;
}
result+=temp;
i++;
precp=fabs(temp);
}while(precp>prec);
cout<<result<<endl;
cout<<exp(x)<<endl;
cout<<i<<endl;
cout<<precp<<endl;
return 0;
}
怎么改才对啊.....帮帮忙..