码迷,mamicode.com
首页 > 编程语言 > 详细

C++取绝对值

时间:2020-02-24 18:48:07      阅读:381      评论:0      收藏:0      [点我收藏+]

标签:c++   include   mat   class   fabs   pre   添加   浮点数   oat   

添加头函数

#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);

C++取绝对值

标签:c++   include   mat   class   fabs   pre   添加   浮点数   oat   

原文地址:https://www.cnblogs.com/blink-cz/p/12357948.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!