首页 > 试题广场 >

已知 ,其中,sh为双曲正弦函数,即。编写一个程序,输入x的

[问答题]

已知 ,其中,sh为双曲正弦函数,即。编写一个程序,输入x的值,求y的值。

推荐
#include<iostream>
#include<cmath>    
using namespace std;
double sh( double t );
int main()
{
 double x,y;
  cout << "x=";
  cin >> x;
  y = sh( 1+sh(x) )/( sh( 2*x )+sh( 3*x ) );
  cout << "y=" << y << endl;
}
double sh( double t )
{  return ( exp( t )-exp( -t ) )/2;  }

发表于 2018-05-07 11:35:34 回复(0)