#include<iostream>
using namespace std;
//定义为double类型,防止溢出。
double GetValue1(int k)
{
if(k==0 || k==1)
return 1;
else return k*GetValue1(k-1);
}
double GetValue2(int k,double x)
{
double temp=1.0;
for(int i=0;i<2*k+1;i++)temp=temp*x;
double temp2=GetValue1(2*k+1);
if(k%2==0)temp=temp/temp2;
else temp=0-temp/temp2;
return temp;
}
double Sin(double x)
{
static int k=0;
double temp=GetValue2(k,x);
if(temp>-0.00001 && temp<0.00001)return temp;
else {
k++;
return temp+Sin(x);
}
}
void main()
{
double pi=3.14;
cout<<Sin(pi/4)<<endl;
}