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

C ++ isless()函数 (C++ isless() function)

isless() function is a library function of cmath header, it is used to check whether the given first value is less than the second value. It accepts two values (float, double or long double) and returns 1 if the first value is less than the second value; 0, otherwise.

isless()函数cmath标头的库函数,用于检查给定的第一个值是否小于第二个值。 它接受两个值( float , double或long double ),如果第一个值小于第二个值,则返回1。 0,否则。

Syntax of isless() function:

isless()函数的语法:

In C99, it has been implemented as a macro,

在C99中,它已实现为宏,

    macro isless(x, y)

In C++11, it has been implemented as a function,

在C ++ 11中,它已作为函数实现,

    bool isless (float x      , float y);
bool isless (double x     , double y);
bool isless (long double x, long double y);

Parameter(s):

参数:

  • x, y – represent the two values to be checked whether x is less than the y.

    x,y –表示两个要检查的值,即x是否小于y 。

Return value:

返回值:

The returns type of this function is bool, it returns 1 if x is less than y; 0, otherwise.

该函数的返回类型为bool ,如果x小于y ,则返回1; 0,否则。

Example:

例:

    Input:
float x = 5.0f;
float y = 15.0f;
Function call:
isless(x, y);
Output:
1

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

// C++ code to demonstrate the example of
// isless() function
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << "isless(0.0f, -2.0f)   : " << isless(0.0f, -2.0f) << endl;
cout << "isless(10.0f, 20.0f)  : " << isless(10.0f, 20.0f) << endl;
cout << "isless(10.0f, 5.0f)   : " << isless(10.0f, 5.0f) << endl;
cout << "isless(-10.0f, -20.0f): " << isless(-10.0f, -20.0f) << endl;
float x = 10.0f;
float y = 5.0f;
// checking using the condition
if (isless(x, y)) {
cout << x << " is less than " << y << endl;
}
else {
cout << x << " is not less than " << y << endl;
}
x = 9.0f;
y = 10.0f;
if (isless(x, y)) {
cout << x << " is less than " << y << endl;
}
else {
cout << x << " is not less than " << y << endl;
}
return 0;
}

Output

输出量

isless(0.0f, -2.0f)   : 0
isless(10.0f, 20.0f)  : 1
isless(10.0f, 5.0f)   : 0
isless(-10.0f, -20.0f): 0
10 is not less than 5
9 is less than 10

Reference: C++ isless() function

参考: C ++ isless()函数

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/541066.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

停牌17个月 汉能薄膜真的要复牌了?

最近&#xff0c;停牌超过一年的汉能薄膜又有新进展。 10月7日&#xff0c;路透社引述知情人士的消息称&#xff0c;香港证监会或将允许汉能薄膜发电复牌&#xff0c;不过复牌的前提是需汉能将符合一些特定条件。 该消息人士透露&#xff0c;证监会告知汉能&#xff0c;若要恢复…

hive java udf_UDF_Hive教程_田守枝Java技术博客

UDF是User-Defined Functions(用户定义函数)的简称。通过以下命令可以查看HIVE中函数的相关文档&#xff1a;SHOW FUNCTIONS;DESCRIBE FUNCTION ;DESCRIBE FUNCTION EXTENDED ;1、UDF函数可以直接应用于select语句&#xff0c;对查询结构做格式化处理后&#xff0c;再输出内容。…

python 示例_带有示例的Python列表remove()方法

python 示例列出remove()方法 (List remove() Method) remove() method is used to remove the first occurrence of the given element, the method is called with this list (the list from which we have to remove the element) and accepts the element to be removed as…

车联网领域,传统TSP企业做错了什么 ?

当下&#xff0c;车联网的定义更加丰富和宽泛&#xff0c;除了传统意义上的Telematics服务&#xff0c;数字服务、移动出行服务、电商平台等将被融入到车联网概念中&#xff0c;与用车相关的维修保养、洗车、代驾等第三方服务&#xff0c;也将成为整车厂整合的重点被纳入到车联…

gettimeofday_PHP gettimeofday()函数与示例

gettimeofdayPHP gettimeofday()函数 (PHP gettimeofday() function) gettimeofday() function is used to get the current time. gettimeofday()函数用于获取当前时间。 Syntax: 句法&#xff1a; gettimeofday(return_float);Parameter(s): 参数&#xff1a; return_floa…

Shell脚本/bin/bash^M: bad interpreter错误解决方法

2019独角兽企业重金招聘Python工程师标准>>> 在windows下保存了一个脚本文件&#xff0c;用ssh上传到centos&#xff0c;添加权限执行nginx提示没有那个文件或目录。 shell脚本放到/etc/init.d/目录下&#xff0c;再执行/etc/init.d/nginx&#xff0c;提示多了这句/…

java中map的遍历方法_Java中Map的三种遍历方式

集合中的三种遍历方式&#xff0c;如下代码&#xff1a;import java.util.Collection;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Set;import java.util.TreeMap;public class TestMap {public static void main(String[] arg…

uuid hashcode_Java UUID hashCode()方法与示例

uuid hashcodeUUID类hashCode()方法 (UUID Class hashCode() method) hashCode() method is available in java.util package. hashCode()方法在java.util包中可用。 hashCode() method is used to retrieve the hash code for this UUID. hashCode()方法用于检索此UUID的哈希码…

java如何遍历combobox_如何通过COMBOBOX设置Java中的框架标题?

我想创建类似下图的内容,当用户从组合框选项中选择年份、月份和日期时,这些操作将更改标题,并且必须根据所选数据进行更改,这很简单,我还是新手到目前为止,我已经做到了,问题是它不起作用,我怎么能做到呢?,你能帮我一下吗?import java.awt.GridLayout;import java.awt.event.…

为什么公司要努力发展数字化战略

发现自身数字化滞后的公司正在遭受因为在二十年前所做的战略决策的煎熬。这里我们将阐述如何才能迎头赶上。 发展数字化战略的公司正在努力促进转型&#xff0c;因为大多数首席信息官(CIO)还没有能力成为数字化领导者。根据Caldwell Partners公司的技术、数字和数据领导事务的管…

java scanner_Java Scanner radix()方法与示例

java scanner扫描器类radix()方法 (Scanner Class radix() method) radix() method is available in java.util package. radix()方法在java.util包中可用。 radix() method is used to return the default or implicit radix of this Scanner. radix()方法用于返回此Scanner的…

java用mysql存储图片_Java存储图片到Mysql

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼【1】视图层action"${ctx}/web/UserInforServlet?methoduserInforServlet" >更换头像立即提交重置var layer,upload,form;//1-页面数据加载$(function () {//【1】加载&初始化layui模块-弹出层与table数据表格la…

ITU衡量信息社会报告:我国ICT发展指数进入亚太前十

11月22日&#xff0c;国际电信联盟&#xff08;ITU&#xff09;发布2016版《衡量信息社会报告》&#xff0c;公布了最新国家和地区ICT发展指数&#xff08;IDI&#xff09;。《报告》显示&#xff0c;排在前十位的国家和地区均来自欧洲和亚洲&#xff0c;韩国以0.01分的优势再次…

treeset java_Java TreeSet clear()方法与示例

treeset javaTreeSet类的clear()方法 (TreeSet Class clear() method) clear() method is available in java.util package. clear()方法在java.util包中可用。 clear() method is used to clear all of the objects that exist from this TreeSet. clear()方法用于清除此TreeS…

Facebook也大干新闻聚合 “新闻快读”向所有媒体开放

去年五月&#xff0c;Facebook推出了不离开本站直接阅读新闻的聚合服务“新闻快读”&#xff08;Instant Articles&#xff09;&#xff0c;用户载入文章的速度大增&#xff0c;不过当时只面向一些特定合作的新闻机构。日前&#xff0c;这一聚合服务全面开始接纳所有的新闻媒体…

kafka偏移量保存到mysql里_【队列】调试应用时进行的kafka偏移量调整

# KAFKA操作记录##export BASE_DIR/home/dba/kafkaexport SERVERS1.1.1.1:9092cd ${BASE_DIR}/bin# 删除残留的消费者./kafka-consumer-groups.sh --bootstrap-server $SERVERS --group DBAAlertSplash --delete --command-config ${BASE_DIR}/config/client.properties# 这个在…

java scanner_Java Scanner match()方法与示例

java scanner扫描器类match()方法 (Scanner Class match() method) match() method is available in java.util package. match()方法在java.util包中可用。 match() method is used to get the MatchResult of the last scanning operation operated by this Scanner. match()…

苹果再次拒绝协助美国政府解锁纽约毒品案中的iPhone

继美国联邦调查局(FBI)成功解锁圣贝纳迪诺市恐袭案枪手 Syed Farook所使用的iPhone 5c后&#xff0c;美国司法部已撤回对苹果公司采取的法律行动。然而近日美国司法部宣布&#xff0c;将继续要求苹果公司协助解锁一部在纽约毒品调查案中查获的iPhone 5s手机。不过苹果今天向美国…

openssl java aes_请问如何使用AES对使用OpenSSL命令加密的Java文件进行解密?

以下是OpenSSLPBEInputStream和OpenSSLPBEOutputStream它可以用于以与OpenSSL兼容的方式加密/解密任意字节流。示例用法&#xff1a;// The original clear text bytesbyte[] originalBytes ...// Encrypt these byteschar[] pwd "thePassword".toCharArray();Byte…

Java ArrayList set()方法与示例

ArrayList类set()方法 (ArrayList Class set() method) set() method is available in java.util package. set()方法在java.util包中可用。 set() method is used to replace the element at the given indices with the given ele(element) in this Arraylist. set()方法用于…