#include
#include
double Cos(double x){ //以弧度为单位
int i,k=1;
double sum=1,an=1;
for(i=2;fabs(an)>=1e-6;i+=2){
k=-k;
an=an*x*x/i/(i-1);
sum+=an*k;
}
return sum;
}
double Cosd(double x){ //以角度为单位
double PI;
PI=atan(1)*4;
return Cos(x*PI/180);
}
int main()
{
printf("cos(%d角度)=%f\n",60,Cosd(60));
printf("cos(%d角度)=%f\n",30,Cosd(30));
printf("%10.8f\n",(Cosd(30)+Cosd(60))*(Cosd(30)+Cosd(60)));
}
(⊙_⊙)