cmath C++ · 头文件
数学函数头文件,提供 std::sqrt、std::sin、std::pow、std::abs 等常见数学函数。
怎么用
#include <cmath>
小例子
#include <cmath> double x = std::sqrt(9.0); std::cout << x;
运行结果
3
提醒:C++ 中这些函数在 std 命名空间里;注意浮点数精度问题
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← C++全部词条