zoukankan      html  css  js  c++  java
  • 一些常用的C++标准函数

    一些常用的C++标准函数


      double atof(const char* p);
      int atoi(const char* p);
      long atol(const char* p); cstdlib 把字符串p转化成所表示的数 与Val类似

      double fabs(double);                           // cmath绝对值函数 与abs类似

      double ceil(double);                            // cmath 取整函数,向上取整
      double floor(double);                          // cmath 取整函数,向下取整
      double sqrt(double);                          // cmath 平方根函数
      double pow(double d, double e);         // cmath 幂函数,返回d的e次方


      double sin(double);                            // cmath 三角函数 
      double cos(double);
      double tan(double); 
      double asin(double);                          // cmath 反三角函数 
      double acos(double);
      double atan(double); 
      double atan2(double y, double x);       // cmath 增强型反正切函数,返回点(x, y)的辐角 很有用,会根据点所在的象限调整弧度值
      double sinh(double);                          // cmath 双曲函数 
      double cosh(double);
      double tanh(double); 


      double exp(double);                          // cmath 指数函数,以e为底
      double log(double);                           // cmath 对数函数,以e为底
      double log10(double);                       // cmath 对数函数,以10为底


      另外,标准C++中并没有提供函数Pi,要获得Pi的值一般这样做:
      const double pi = acos(0.) * 2;

    来自http://bbs.tianya.cn/post-itinfo-181747-1.shtml

  • 相关阅读:
    听较强节奏的歌曲,能让你更长时间投入到学习中
    小康网站维护笔记
    apache基础
    python安装多版本
    apache负载调优
    docker 进阶
    openstack 网络更改版
    linux 搭建testlink的问题总结
    26. Remove Duplicates from Sorted Array(LeetCode)
    Add to List 172. Factorial Trailing Zeroes(LeetCode)
  • 原文地址:https://www.cnblogs.com/VVingerfly/p/4403618.html
Copyright © 2011-2022 走看看