【问题描述】编写数学类,能求开平方,sin 绝对值,圆面积等操作

【问题描述】

编写数学类,能求开平方,sin 绝对值,圆面积等操作

【样例输入输出】

input a number:3.5
the result of sqrt is:1.87083
the result of sin is:-0.350783
the result of fabs is:3
the result of fabs is:3.5
the result of area is:38.4845
#include 
#include 
using namespace std;

class  myMath  {
public:
        static  double  mysqrt(double  x);
        static  double  mysin(double  x);
        static double myfabs(double x);
                static  int  myfabs(int  x);
        static  double  circleArea(double  x);
private:
                const  static  double  PI;
};

const double myMath::PI = 3.1415926;

double myMath::mysqrt(double x)
{
    return sqrt(x);
}

double myMath::mysin(double x)
{
    return sin(x);
}

double myMath::myfabs(double x)
{
    return fabs(x);
}

int  myMath::myfabs(int  x)
{  return  fabs(x);}
double  myMath::circleArea(double  x)
{  return  PI*x*x;}
int  main()
{  double  x;
    cout<<"input  a  number:";
    cin>>x;
    cout<<"the  result  of  sqrt  is:"<

你可能感兴趣的:(c++,算法)