练习·数学库函数

单选题 难度 1

#math-lib

求平方根用哪个函数?

题目

C++ 中计算 x 的平方根应使用哪个函数?
  1. sqrt(x)
  2. pow(x)
  3. abs(x)
  4. root(x)

知识点讲解

cmath 常用函数:sqrt 平方根、pow(a,b) 幂、abs 绝对值、floor/ceil 向下/上取整。用前 #include <cmath>。

来小码星球,动手写一遍 →