添加头函数
#include<cmath>
对于整数:
int abs(int i)
对于浮点数:
double fabs(double i)
float fabs(float i)
C++11标准
double abs (double x);
float abs (float x);
long double abs (long double x);
double abs (T x);
原文:https://www.cnblogs.com/blink-cz/p/12357948.html