C/C++中的绝对值函数

--------开始--------

对于不同类型的数据对应的绝对值函数也不相同,在c和c++中分别在头文件math.h 和 cmath 中。

int :

x = abs( n )
double :

x = fabs( n )
long :

x = labs( n )

--------结束--------

猜你喜欢

转载自www.cnblogs.com/chuyds/p/10646103.html