hcx1.cpp

来自「公式计算例子关于sin方程组」· C++ 代码 · 共 32 行

CPP
32
字号
// hcx1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
#include <math.h>

void main()
{double k,s,r;
 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 + =
减小字号Ctrl + -
显示快捷键?