c語言 函數的參數傳遞示例_isunordered()函數與C ++中的示例

c語言 函數的參數傳遞示例

C ++ isunordered()函數 (C++ isunordered() function)

isunordered() function is a library function of cmath header, it is used to check whether the given values are unordered (if one or both values are Not-A-Number (NaN)), then they are unordered values). It accepts two values (float, double or long double) and returns 1 if the given values are unordered; 0, otherwise.

isunordered()函數cmath標頭的庫函數,用于檢查給定值是否無序(如果一個或兩個值均為非數字(NaN),則它們為無序值)。 它接受兩個值( float , double或long double ),如果給定的值是無序的,則返回1;否則,返回1。 0,否則。

Syntax of isunordered() function:

isunordered()函數的語法:

In C99, it has been implemented as a macro,

在C99中,它已實現為宏,

    macro isunordered(x, y)

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

在C ++ 11中,它已作為函數實現,

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

Parameter(s):

參數:

  • x, y – represent the values to be checked as unordered.

    x,y –表示要檢查的值是否為無序。

Return value:

返回值:

The returns type of this function is bool, it returns 1 if one or both arguments are NaN; 0, otherwise.

該函數的返回類型為bool ,如果一個或兩個參數均為NaN,則返回1;否則返回0。 0,否則。

Example:

例:

    Input:
float x = sqrt(-1.0f);
float y = 10.0f;
Function call:
isunordered(x, y);
Output:
1
Input:
float x = 1.0f;
float y = 10.0f;
Function call:
isunordered(x, y);
Output:
0

C ++代碼演示isunordered()函數的示例 (C++ code to demonstrate the example of isunordered() function)

// C++ code to demonstrate the example of
// isunordered() function
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << "isunordered(-5.0f, -2.0f): " << isunordered(-5.0f, -2.0f) << endl;
cout << "isunordered(sqrt(-1.0f), sqrt(-2.0f)): " << isunordered(sqrt(-1.0f), sqrt(-2.0f)) << endl;
cout << "isunordered(10.0f, sqrt(-1.0f)): " << isunordered(10.0f, sqrt(-1.0f)) << endl;
cout << "isunordered(sqrt(-1.0f), 1.0f): " << isunordered(sqrt(-1.0f), 1.0f) << endl;
float x = 10.0f;
float y = 5.0f;
// checking using the condition
if (isunordered(x, y)) {
cout << x << "," << y << " are unordered." << endl;
}
else {
cout << x << "," << y << " are not unordered." << endl;
}
x = 10.0f;
y = sqrt(-1.0f);
if (isunordered(x, y)) {
cout << x << "," << y << " are unordered." << endl;
}
else {
cout << x << "," << y << " are unordered." << endl;
}
return 0;
}

Output

輸出量

isunordered(-5.0f, -2.0f): 0
isunordered(sqrt(-1.0f), sqrt(-2.0f)): 1
isunordered(10.0f, sqrt(-1.0f)): 1
isunordered(sqrt(-1.0f), 1.0f): 1
10,5 are not unordered.
10,-nan are unordered.

Reference: C++ isunordered() function

參考: C ++ isunordered()函數

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

c語言 函數的參數傳遞示例

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/541442.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541442.shtml
英文地址,請注明出處:http://en.pswp.cn/news/541442.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

java進一_JAVA小白進:基礎入門知識

1.注釋&#xff0c;關鍵字&#xff0c;標識符1.注釋(1)注釋&#xff1a;解釋說明程序的而文字。(2)注釋的分類&#xff1a;單行注釋 格式&#xff1a; //注釋的文字多行注釋 格式&#xff1a;/*注釋的文字*/文檔注釋 格式&#xff1a;/**注釋的文字*/(3)注釋的作用&#xff1a;…

補丁(patch)的制作與應用

為什么80%的碼農都做不了架構師&#xff1f;>>> 轉自http://linux-wiki.cn/wiki/zh-hans/%E8%A1%A5%E4%B8%81(patch)%E7%9A%84%E5%88%B6%E4%BD%9C%E4%B8%8E%E5%BA%94%E7%94%A8 如果hack了開源代碼&#xff0c;為了方便分享&#xff08;如提交Bug&#xff09;或自己…

php知識點匯總與解答_PHP操作員能力傾向問題與解答

php知識點匯總與解答This section contains Aptitude Questions and Answers on PHP Operators. 本節包含有關PHP運算符的 Aptitude問答。 1) Which of the following types of operators are used in PHP? Arithmetic OperatorsLogical OperatorsArray OperatorsString Oper…

csv導入mysql phpmyadmin_【轉】從phpMyAdmin批量導入Excel內容到MySQL(親測非常簡潔有效)...

今天做項目遇到需要用phpMyAdmin批量導入Excel內容到MySQL數據庫。分析了我的踏坑經歷并且總結一最便捷的一套導入數據的方法&#xff0c;非常實用簡潔&#xff1a;1、修改Excel表的數據&#xff0c;使得Excel中的字段與數據庫字段要一一對應&#xff0c;并加上自增id。2、然后…

weakhashmap_Java WeakHashMap putAll()方法與示例

weakhashmapWeakHashMap類的putAll()方法 (WeakHashMap Class putAll() method) putAll() method is available in java.util package. putAll()方法在java.util包中可用。 putAll() method is used to copy all of the associations or mappings from the given map and assig…

c語言memcmp和java的_C語言memcmp()函數:比較m字節長的兩個字符串s1和s2

函數名&#xff1a;memcmp頭文件&#xff1a;函數原型&#xff1a; void* memcmp(void *s1,void *s2,unsigned m);功能&#xff1a;比較m字節長的兩個字符串s1和s2參數&#xff1a; s1 和 s2 為要比較的字符串unsigned m 為要比較的前m個字節返回值&#xff1a;s1s1s2 返回等…

[下載地址] Subclipse 1.10.9(SVN) _附說明

http://pan.baidu.com/s/1bp6EFHt轉載于:https://www.cnblogs.com/gscq073240/articles/6814429.html

hbase 偽分布安裝 java_HBase基礎和偽分布式安裝配置

一、HBase(NoSQL)的數據模型1.1 表(table)&#xff0c;是存儲管理數據的。1.2 行鍵(row key)&#xff0c;類似于MySQL中的主鍵&#xff0c;行鍵是HBase表天然自帶的&#xff0c;創建表時不需要指定1.3 列族(column family)&#xff0c;列的集合。一張表中有多個行健&#xff0c…

java treemap_Java TreeMap firstEntry()方法及示例

java treemapTreeMap類的firstEntry()方法 (TreeMap Class firstEntry() method) firstEntry() method is available in java.util package. firstEntry()方法在java.util包中可用。 firstEntry() method is used to retrieve the key-value pairs linked with the lowest valu…

linux常用網絡命令ping和arping

linux常用網絡命令ping和arping ping 向目標主機發送icmp請求包 常用來測試當前主機與目標主機網絡連接狀況 常見選項 -c 設置發包的個數 -s 設置發的包的塊大小&#xff0c;最大不超過65507 -W 設置接收回應超時時間 -i …

java printwriter實例_PrintWriter做過濾流+FileWriter案例分析

package com.mstf.ui;import java.io.*;public class TestWriter{public static void main(String args[]){//PrintWriter做過濾流FileWriter//doFilter1();//2、PrintWriter做過濾流OutputStreamWriter//doFilter2();//3、PrintWriter可以作為節點流//doNode();//4、PrintWrit…

treemap比較器_Java TreeMap比較器()方法與示例

treemap比較器TreeMap類的compare()方法 (TreeMap Class comparator() method) comparator() method is available in java.util package. 比較器()方法在java.util包中可用。 comparator() method is used to return the key element in this TreeMap based on the Comparator…

洛谷P1204 [USACO1.2]擠牛奶Milking Cows 前綴和

這題數據比較水 暴搜都能夠過去 1 #include <cstdio>2 #include <cmath>3 #include <cstdlib>4 #include <algorithm>5 #include <string>6 #include <iostream>7 #include <iomanip>8 #include <cstring>9 using namespace s…

java script創建對象_JavaScript七種非常經典的創建對象方式

JavaScript創建對象的方式有很多&#xff0c;通過Object構造函數或對象字面量的方式也可以創建單個對象&#xff0c;顯然這兩種方式會產生大量的重復代碼&#xff0c;并不適合量產。接下來介紹七種非常經典的創建對象的方式&#xff0c;他們也各有優缺點。一、工廠模式可以無數…

java 方法 示例_Java掃描儀具有示例的NextNextInt()方法

java 方法 示例掃描器類的hasNextInt()方法 (Scanner Class hasNextInt() method) Syntax: 句法&#xff1a; public boolean hasNextInt();public boolean hasNextInt(int rad);hasNextInt() method is available in java.util package. hasNextInt()方法在java.util包中可用…

axis2開發webservice之編寫Axis2模塊(Module)

axis2中的模塊化開發。能夠讓開發者自由的加入自己所需的模塊。提高開發效率&#xff0c;減少開發的難度。 Axis2能夠通過模塊&#xff08;Module&#xff09;進行擴展。Axis2模塊至少須要有兩個類&#xff0c;這兩個類分別實現了Module和Handler接口。開發和使用一個Axis2模塊…

java 看書瀏覽器官_JAVA讀取文件流,設置瀏覽器下載或直接預覽操作

最近項目需要在瀏覽器中通過url預覽圖片。但發現瀏覽器始終默認下載&#xff0c;而不是預覽。研究了一下&#xff0c;發現了問題&#xff1a;// 設置response的header&#xff0c;注意這句&#xff0c;如果開啟&#xff0c;默認瀏覽器會進行下載操作&#xff0c;如果注釋掉&…

Java PriorityQueue poll()方法與示例

PriorityQueue類poll()方法 (PriorityQueue Class poll() method) poll() method is available in java.util package. poll()方法在java.util包中可用。 poll() method is used to return the first element with removing an element from this PriorityQueue. poll()方法用于…

scrapy抓取淘寶女郎

scrapy抓取淘寶女郎 準備工作 首先在淘寶女郎的首頁這里查看&#xff0c;當然想要爬取更多的話&#xff0c;當然這里要查看翻頁的url,不過這操蛋的地方就是這里的翻頁是使用javascript加載的&#xff0c;這個就有點尷尬了&#xff0c;找了好久沒有找到&#xff0c;這里如果有朋…

map在Java集合_java集合之Map

MapMap用于保存具有映射關系的數據。Map中key不允許重復&#xff0c;value可以重復&#xff0c;key和value之間存在單向一對一關系HashMap和Hashtable區別1 Hashtable線程安全、HashMap線程不安全&#xff0c;所以HashMap性能高一點2 Hashtable不允許用null做key和value&#x…