C ++ fmax()函数 (C++ fmax() function)

fmax() function is a library function of cmath header, it is used to find the maximum value of the given numbers, it accepts two number and returns the larger one.

fmax()函数cmath标头的库函数,用于查找给定数字的最大值,它接受两个数字并返回较大的一个。

Syntax of fmax() function:

fmax()函数的语法:

    fmax(x, y);

Parameter(s): x, y – are the numbers to be used to find the larger value.

参数: x,y –是用于查找较大值的数字。

Return value: double – it returns double value that is the larger value of x and y.

返回值: double-返回x和y中的较大值的double值。

Example:

例:

    Input:
float x = 20;
float y = 10;
Function call:
fmax(x,y);
Output:
20

C ++代码演示fmax()函数的示例 (C++ code to demonstrate the example of fmax() function)

// C++ code to demonstrate the example of
// fmax() function
#include <iostream>
#include <cmath>
using namespace std;
// main() section
int main()
{float x;
float y;
float result;
//input the numbers
cout<<"Enter first number : ";
cin>>x;
cout<<"Enter second number: ";
cin>>y;
//finding the maximum number
result = fmax(x,y);
cout<<"fmax("<<x<<","<<y<<"): "<<result;
cout<<endl;
return 0;
}

Output

输出量

First run:
Enter first number : 10
Enter second number: -20
fmax(10,-20): 10
Second run:
Enter first number : 10
Enter second number: 20
fmax(10,20): 20
Third run:
Enter first number : 123.90
Enter second number: 121.88
fmax(123.9,121.88): 123.9
Fourth run:
Enter first number : -123.45
Enter second number: -121.56
fmax(-123.45,-121.56): -121.56

翻译自: https://www.includehelp.com/cpp-tutorial/fmax-function-with-example.aspx

fmax()函数以及C ++中的示例相关推荐

  1. python 功能键ord_ord()函数以及Python中的示例

    Python ord() 功能 ord()函数是Python中的一个库函数,它用于从给定的字符值中获取数字值,它接受一个字符并返回一个整数,即用于将字符转换为整数,即用于获取a的ASCII值.给定的字 ...

  2. python中pow函数_pow()函数以及Python中的示例

    python中pow函数 Python pow()函数 (Python pow() function) pow() function is a library function in Python, ...

  3. to_number用法示例_Number()函数以及JavaScript中的示例

    to_number用法示例 Number()函数 (Number() function) Number() function is a predefined global function in Ja ...

  4. eval 函数 代替函数_eval()函数以及JavaScript中的示例

    eval 函数 代替函数 eval()函数 (eval() function) eval() function is a predefined global function in JavaScrip ...

  5. python中len函数_len()函数以及Python中的示例

    python中len函数 Python len()函数 (Python len() function) len() function is a library function in Python, ...

  6. java中isnan函数_isNaN()函数以及JavaScript中的示例

    java中isnan函数 Prerequisite: NaN property in JavaScript 先决条件: JavaScript中的NaN属性 isNaN()函数 (isNaN() fun ...

  7. c语言 函数的参数传递示例_isgreater()函数以及C ++中的示例

    c语言 函数的参数传递示例 C ++ isgreater()函数 (C++ isgreater() function) isgreater() function is a library functi ...

  8. isless()函数与C ++中的示例

    C ++ isless()函数 (C++ isless() function) isless() function is a library function of cmath header, it ...

  9. c语言 函数的参数传递示例_isunordered()函数与C ++中的示例

    c语言 函数的参数传递示例 C ++ isunordered()函数 (C++ isunordered() function) isunordered() function is a library ...

最新文章

  1. 慢SQL,压垮团队的最后一根稻草No.92
  2. 华为存储S58000T-硬盘更换
  3. POJ2308连连看dfs+bfs+优化
  4. wxWidgets:Erase wxWidgets示例
  5. 书呆子rico_寻找设计和类型书呆子的清道夫
  6. 【渝粤教育】电大中专电商运营实操 (15)作业 题库
  7. centos7 端口相关操作
  8. mysql 正则 换行符_MySQL 正则表达式
  9. 基于Velocity的Web开发指南
  10. Redis下载和安装
  11. Autolisp:利用AuoCAD之Lisp编程案例之智能加工齿轮的演示程序
  12. 【Flash】关于Flash停止支持相关问题总结
  13. RINEX3广播星历中的toc,toe,IODE 及时间规化
  14. WebSocket简介
  15. 用计算机程序计算兴利库容,闸坝多目标泄流估算方法及系统与流程
  16. docker 中使用nginx容器无法正常启动,报错signal process started和kili(3255,1) failed (3: No such process)
  17. ffmpeg读取加密的m3u8文件时无法访问.key文件
  18. LIGO找到首个超越广义相对论的证据?
  19. gitlab迁移坑深路远
  20. 15 路由器综合路由配置

热门文章

  1. 单片机备用电池供电电路_第五节(重排) 电子入门 复位电路
  2. extjs 基础部分
  3. css定位position
  4. Inside Kolla - 04 Kolla 目录结构
  5. 有关域索引错误产生的原因及解决办法
  6. vagrant使用centos的环境安装..
  7. java中的codereview
  8. 智能课程表Android版-学年学期星期的实现
  9. 删除了注册表winsock项及winsock2项怎么办
  10. 面试英语自我介绍的常用词汇