——–开始——–

 

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

 

int :

x = abs( n )

 

double :

x = fabs( n )

 

long :

x = labs( n )

 

 

——–结束——–

转载于:https://www.cnblogs.com/chuyds/p/10646103.html