当前位置:网站首页>Abs (), fabs () and LABS ()
Abs (), fabs () and LABS ()
2022-08-03 20:12:00 【Luna programming】
abs ()
Syntax:
#include
int abs( int num ); //parameter type is int typep>
Function: The function returns the absolute value of the parameter num.For example:
int magic_number = 10;cout << "Enter a guess: ";cin >> x;cout << "Your guess was " << abs( magic_number - x ) << " away from the magic number." << endl;
labs ()
Syntax:
#include
long labs( long num );//The parameter type is long long
Function: The function returns the absolute value of the parameter num.
fabs ()
Syntax:
#include
double fabs( double arg );//The parameter type is double
Function: The function returns the absolute value of the parameter arg.
Mainly to find the absolute value of the higher precision double or float type
The above three functions can share a header file
边栏推荐
猜你喜欢
随机推荐
双线性插值公式推导及Matlab实现
leetcode 125. 验证回文串
149. The largest number on a straight line, and check the set
alicloud3搭建wordpress
自定义form表单验证
glide set gif start stop
Use ControlTemplate or Style from resource file in WPF .cs and find the control
倒计时2天,“文化数字化战略新型基础设施暨文化艺术链生态建设发布会”启幕在即
leetcode 899. 有序队列
C51 存储类型与存储模式
php截取中文字符串实例
从腾讯阿里等大厂出来创业搞 Web3、元宇宙的人在搞什么
tRNA甲基化偶联3-甲基胞嘧啶(m3C)|tRNA-m3C (3-methylcy- tidine)
收藏-即时通讯(IM)开源项目OpenIM-功能手册
Hinton2022年RobotBrains访谈记录
JMeter笔记5 |Badboy使用和录制
【STM32】标准库-自定义BootLoader
MySQL Basics
力扣59-螺旋矩阵 II——边界判断
leetcode 136. 只出现一次的数字(异或!!)