【C++】第2章:(一)算术运算

优先级:

优先级最高:- :取相反数

函数:

  1. exp(x): e^x
  2. pow(x,y):x^y
  3. sqrt(x): x的平方根
  4. fabs(x):|x|
  5. log(x):lnx,(x>0)
  6. log10(x):lgx,(x>0)
  7. sin(x): sinx,x为弧度值
  8. cos(x):cosx,x为弧度值
    使用函数时要在开头加上标准库函数:
#include <cmath>
using namespace std;

有负数参与的取余%运算:

得数的正负和前面那个数一致
例如:9 % -4 = 1,-9 % 4 = -1,-9 % -4 = -1

发布了19 篇原创文章 · 获赞 0 · 访问量 226

猜你喜欢

转载自blog.csdn.net/weixin_44825297/article/details/104845525
今日推荐