hypot函数_hypot()函数与C ++中的示例
hypot函数
C ++ hypot()函数 (C++ hypot() function)
hypot() function is a library function of cmath header, it is used to find the hypotenuse of the given numbers, it accepts two numbers and returns the calculated result of hypotenuse i.e. sqrt(x*x + y*y).
hypot()函数是cmath标头的库函数,用于查找给定数字的斜边,接受两个数字并返回斜边的计算结果,即sqrt(x * x + y * y) 。
Syntax of hypot() function:
hypot()函数的语法:
hypot(x, y);
Parameter(s): x, y – numbers to be calculated hypotenuse (or sqrt(x*x + y*y))
参数: x,y –要计算的斜边数(或sqrt(x * x + y * y) )
Return value: double – it returns double value that is the result of the expression sqrt(x*x + y*y).
返回值: double-它返回double值,该值是表达式sqrt(x * x + y * y)的结果 。
Example:
例:
Input:
float x = 10.23;
float y = 2.3;
Function call:
hypot(x, y);
Output:
10.4854
C ++代码演示hypot()函数的示例 (C++ code to demonstrate the example of hypot() function)
// C++ code to demonstrate the example of
// hypot() function
#include <iostream>
#include <cmath>
using namespace std;
// main code section
int main()
{float x = 10.23;
float y = 2.3;
// calculate the hypotenuse
float result = hypot(x, y);
cout<<"hypotenuse of "<<x<<" and "<<y<<" is = "<<result;
cout<<endl;
//using sqrt() function
result = sqrt((x*x + y*y));
cout<<"hypotenuse of "<<x<<" and "<<y<<" is = "<<result;
cout<<endl;
return 0;
}
Output
输出量
hypotenuse of 10.23 and 2.3 is = 10.4854
hypotenuse of 10.23 and 2.3 is = 10.4854
翻译自: https://www.includehelp.com/cpp-tutorial/hypot-function-with-example.aspx
hypot函数
hypot函数_hypot()函数与C ++中的示例相关推荐
- java函数参数使用冒号_java8中:: 用法示例(JDK8双冒号用法)
JDK8中有双冒号的用法,就是把方法当做参数传到stream内部,使stream的每个元素都传入到该方法里面执行一下. 代码其实很简单: 以前的代码一般是如此的: public class Accep ...
- stl vector 函数_vector :: clear()函数,以及C ++ STL中的示例
stl vector 函数 C ++ vector :: clear()函数 (C++ vector::clear() function) vector::clear() is a library f ...
- stl vector 函数_vector :: push_back()函数,以及C ++ STL中的示例
stl vector 函数 C ++ vector :: push_back()函数 (C++ vector::push_back() function) vector::push_back() is ...
- c语言中vector函数大全,vector :: empty()函数,以及C ++ STL中的示例
C ++ vector :: empty()函数 矢量::空()是一个库函数"载体"头,它是用来检查给定的矢量是否是一个空的载体或没有,它返回一个真,如果矢量大小为0,否则返回假. ...
- stl vector 函数_vector :: crbegin()函数,以及C ++ STL中的示例
stl vector 函数 C ++ vector :: crbegin()函数 (C++ vector::crbegin() function) vector::crbegin() is a lib ...
- main函数参数,在VS中向命令行添加参数的方法
问题描述 使用main函数的参数,实现一个整数计算器,程序可以接受三个参数,第一个参数"-a"选项执行加法,"-s"选项执行减法,"-m"选 ...
- 函数指针--Nginx和Redis中两种回调函数写法
1.Nginx和Redis中两种回调函数写法 #include <stdio.h>//仿Nginx风格 //结构外声明函数指针类型 typedef void (*ngx_connectio ...
- ACMNO.40 C语言-子串 有一字符串,包含n个字符。写一函数,将此字符串中从第m个字符开始的全部字符复制成为另一个字符串
题目描述 有一字符串,包含n个字符. 写一函数,将此字符串中从第m个字符开始的全部字符复制成为另一个字符串. 输入 数字n 一行字符串 数字m 输出 从m开始的子串 样例输入 6 abcdef 3 样 ...
- R语言使用basename函数获取数据链接地址中的文件名称(removes all of the path up to and including the last path separator )
R语言使用basename函数获取数据链接地址中的文件名称(removes all of the path up to and including the last path separator (i ...
- pandas使用iteritems函数迭代地查看dataframe中的每个数据列(iterate over each column of a dataframe)
pandas使用iteritems函数迭代地查看dataframe中的每个数据列(iterate over each column of a dataframe) 目录 pandas使用iterite ...
最新文章
- java 操作系统 模拟 daima_求C/C++或java写的比较简单的操作系统的模拟程序
- 在现代引擎游戏中使用正确的渲染打光流程
- Dockerfile文件创建centos:7,配置JDK8的环境变量,与运行springboot的jar包,的镜像
- 使用javamail进行邮件发送
- js监听地址栏变化_vue中本地储存也可以实时监听
- 买了服务器之后如何操作系统,买了服务器之后如何操作系统
- pvid和vid区别,tag口和untag口区别
- 客气:是礼貌,更是修养 — 《别输在不会表达上》
- 26.Yii 模块(2)
- 在中国在行其道的智慧城市,为何折戟多伦多? | 凌云时刻
- delphi7的加密算法与 delphi XE+加解密算法
- 如何停止线程?stop方法过时弊端
- android 手机内存分配,【扫盲贴』关于android手机中RAM(也就是 运行内存)的分配...
- 不积跬步 无以至千里
- 前端学习——Prop
- 常用的数量统计量的计算及统计意义
- 个人用微信,支付宝在网站收款实现
- 数据库——sql修改主键
- 服务器搭建微信会员卡系统,智络会员管理系统如何与微信对接
- 浦东创变者 | 查湃智能付斌做水下智能领域的乘风破浪者
热门文章
- Linux命令行下感叹号的几个用法
- 2.3单链表的基本使用及其cpp示例
- java 百度poi_Android应用中使用百度地图API之POI(三)
- linux课堂笔记(8)
- python axis 0 1_python pandas 中axis值0 1怎么分行还是列
- es 删除重复数据_怎么标识并删除SPSS数据库里的“重复个案”?
- iphone怎样关闭副屏_小米新设计专利曝光:“Z”型折叠屏手机
- Spark初识-Spark基本架构概览使用
- C#解密出生日期【C#】
- Exchange队列优先级介绍和配置