?? 3_5.cpp
字號:
//3_5.cpp
#include <iostream>
#include<cmath> //頭文件cmath中具有對C++標準庫中數學函數的說明
using namespace std;
void main()
{
double k,r,s;
double tsin(double x);
cout<<"r=";
cin>>r;
cout<<"s=";
cin>>s;
if (r*r<=s*s)
k=sqrt(tsin(r)*tsin(r)+tsin(s)*tsin(s)) ;
else
k=tsin(r*s)/2;
cout<<k<<endl;
}
double tsin(double x)
{
double p=0.000001,g=0,t=x;
int n=1;
do {
g=g+t;
n++;
t=-t*x*x/(2*n-1)/(2*n-2);
}while(fabs(t)>=p);
return g;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -