c語言 函數的參數傳遞示例_restder()函數,帶有C ++中的示例

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

C ++ restder()函數 (C++ remainder() function)

remainder() function is a library function of cmath header, it is used to calculate the remainder (IEC 60559), it accepts two parameters (numerator and denominator) and returns the remainder (floating-point) of numerator/denominator rounded to nearest,

restder()函數cmath標頭的庫函數,用于計算余數(IEC 60559),它接受兩個參數( 分子分母 ),并返回四舍五入到最接近的分子 / 分母的余數(浮點數),

    remainder = numerator - rquot * denominator

Where, rquot is the value of numerator/denominator (rounded to the nearest integral value with halfway cases rounded toward the even number.

其中, rquot分子 / 分母的值(四舍五入為最接近的整數值,中位數為四舍五入為偶數)。

Syntax of remainder() function:

restder()函數的語法:

C++11:

C ++ 11:

     double remainder (double numer     , double denom);
float remainder (float numer      , float denom);
long double remainder (long double numer, long double denom);
double remainder (Type1 numer      , Type2 denom);

Parameter(s):

參數:

  • numer, denom – represent the values of numerator and denominator.

    numer,denom –表示分子分母的值。

Return value:

返回值:

It returns the remainder.

它返回余數。

Note:

注意:

  • If the remainder is 0, then its sign is the same as the sign of numer.

    如果余數為0,則其符號與numer的符號相同。

  • If the value of denom is 0, the result may either 0 or it may cause a domain error.

    如果denom的值為0,則結果可能為0或可能導致域錯誤。

Example:

例:

    Input:
double x = 15.46;
double y = 12.56;
Function call:
remainder(x, y);
Output:
2.9

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

// C++ code to demonstrate the example of
// remainder() function
#include <iostream>
#include <cmath>
using namespace std;
// main() section
int main()
{
double x;
double y;
x = 10;
y = 2;
cout << "remainder(" << x << "," << y << "): " << remainder(x, y);
cout << endl;
x = 5.3;
y = 2;
cout << "remainder(" << x << "," << y << "): " << remainder(x, y);
cout << endl;
x = 15.46;
y = 12.56;
cout << "remainder(" << x << "," << y << "): " << remainder(x, y);
cout << endl;
x = -10.2;
y = 2;
cout << "remainder(" << x << "," << y << "): " << remainder(x, y);
cout << endl;
return 0;
}

Output

輸出量

remainder(10,2): 0
remainder(5.3,2): -0.7
remainder(15.46,12.56): 2.9
remainder(-10.2,2): -0.2

Reference: C++ remainder() function

參考: C ++ restder()函數

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

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

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

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

相關文章

jquery validation-jquery的驗證框架 詳解(1)

jquery validation驗證框架是一款非常優秀的客戶端數據驗證框架。我們在日常的項目中都會應用得到。今天開始我們會分兩到三個個階段 詳細的了解這款插件 至于這款插件是多么的優秀&#xff0c;怎么個描述法 我這里就不詳細述說。大家可以在接下來的時間里接觸并且感覺它的強大…

已知一個摻雜了多個數字字符的中文名拼音,去掉所有數字字符之后,形式為“名”+空格+“姓”;并且名和姓的首字母大寫,其他小寫,要求輸出姓名全拼,且全為小寫。(后附詳細樣例說明)

已知一個摻雜了多個數字字符的中文名拼音&#xff0c;去掉所有數字字符之后&#xff0c;形式為“名”空格“姓”&#xff1b;并且名和姓的首字母大寫&#xff0c;其他小寫&#xff0c;要求輸出姓名全拼&#xff0c;且全為小寫。&#xff08;后附詳細樣例說明&#xff09; 【輸入…

【視覺項目】【day2】8.21號實驗記錄(手機固定高度15cm拍攝+直方圖均衡化+模板匹配,模板12個,測試28個,效果十分差)

目錄均衡化代碼模板圖片按照大小排序總代碼測試效果新思路由于模板匹配是像素之間的比對&#xff0c;所以不同光照下的像素灰度值也會不同 所以在比對之前&#xff0c;我們需要對測試圖和模板圖進行直方圖均衡化&#xff0c;這一步可以先實現。 今天將采用批量處理的方式&#…

c語言 函數的參數傳遞示例_isgreater()函數以及C ++中的示例

c語言 函數的參數傳遞示例C isgreater()函數 (C isgreater() function) isgreater() function is a library function of cmath header, it is used to check whether the given first value is greater than the second value. It accepts two values (float, double or long…

在一個風景秀麗的小鎮,一天早上,有N名晨跑愛好者(編號1~N)沿著優雅的江邊景觀道朝同一方向進行晨跑

【問題描述】 在一個風景秀麗的小鎮&#xff0c;一天早上&#xff0c;有N名晨跑愛好者(編號1~N)沿著優雅的江邊景觀道朝同一方向進行晨跑&#xff0c;第i名跑者從位置si處起跑&#xff0c;且其速度為Vi。換句話說&#xff0c;對所有的實數t≥0&#xff0c;在時刻t時第i名跑者的…

linux內核測試,Linux內核測試的生命周期

內核持續集成(CKI)項目旨在防止錯誤進入 Linux 內核。在 Linux 內核的持續集成測試 一文中&#xff0c;我介紹了 內核持續集成Continuous Kernel Integration(CKI)項目及其使命&#xff1a;改變內核開發人員和維護人員的工作方式。本文深入探討了該項目的某些技術方面&#xff…

Linux下動態庫使用小結

1. 靜態庫和動態庫的基本概念 靜態庫&#xff0c;是在可執行程序連接時就已經加入到執行碼中&#xff0c;在物理上成為執行程序的一部分&#xff1b;使用靜態庫編譯的程序運行時無需該庫文件支持&#xff0c;哪里都可以用&#xff0c;但是生成的可執行文件較大。動態庫&#xf…

【視覺項目】【day3】8.22號實驗記錄(利用canny檢測之后的來進行模板匹配)

【day3】8.22號實驗記錄&#xff08;幾乎沒干正事的一天&#xff0c;利用canny檢測之后的來進行模板匹配&#xff09; 今天沒搞代碼&#xff0c;主要是問研究生學長工業攝像頭的接法的&#xff0c;學長也不知道&#xff0c;明天問問老師。。。 晚上搞了一下canny之后的模板匹配…

scala字符替換_如何替換Scala中的“壞”字符?

scala字符替換In Scala, programming language, all sorts of special characters are valid. The character set library is quite good and supports almost all characters in Scala programming. 在編程語言Scala中&#xff0c;各種特殊字符均有效。 字符集庫非常好&#x…

linux dd 大文件下載,Linux dd+grep 大文件二分查找

Linux dd 命令用于讀取、轉換并輸出數據。dd 可從標準輸入或文件中讀取數據&#xff0c;根據指定的格式來轉換數據&#xff0c;再輸出到文件、設備或標準輸出。參數說明(dd --help)Usage: dd [OPERAND]...or: dd OPTIONCopy a file, converting and formatting according to th…

【視覺項目】【day1】8.20號實驗記錄(初步使用模板匹配)

目錄【day1】8.20號實驗記錄&#xff08;初步使用模板匹配&#xff09;模板匹配單張圖的代碼利用多個模板去匹配多張圖的代碼寫代碼過程中遇到的問題【day1】8.20號實驗記錄&#xff08;初步使用模板匹配&#xff09; 模板匹配 利用模板匹配可以框定出瓶子&#xff0c;但是卻…

第四章 纖維結構對染色性能的影響單元測驗

1,利用紅外光譜技術可以測定纖維的() 化學結構。 2,纖維完整的結構包括() 化學結構。 表面形態結構。 內部超分子結構。 3,纖維化學結構由于影響了纖維(),進而影響其染色性能 吸濕溶脹性能。 在染液中電離性能。 在染浴中的帶電性。 與染液中各組分之間的作用力。 …

創建存儲過程時出現的This function has none of DETERMINISTIC, NO SQL解決辦法

This function has none of DETERMINISTIC, NO SQL解決辦法創建存儲過程時 出錯信息&#xff1a; ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the …

如何讓沒有安裝網頁中所需字體的用戶也能得到一致的瀏覽效果【轉】

今天給大家談一個關于字體的話題,我們在做項目的過程中會遇到一些在psd中的字體在自己的電腦中沒有安裝&#xff0c;或者是一些特殊的文字&#xff0c;通常的做法是把它切成圖片&#xff0c;但是如果這個站是多個語言的&#xff0c;那我們是不是把每個語言的都切一張圖片呢&…

【視覺項目】【day4】8.24號實驗記錄(消除瓶子內部“邊緣”)

思路分析以及代碼 思路1&#xff1a;使用findContours函數&#xff0c;設置輪廓為最外部RETR_EXTERNAL&#xff0c;結果發現結果仍然是所有輪廓。 思路2&#xff1a;先二值化&#xff0c;然后進行閉操作&#xff0c;然后canny&#xff0c;得到的輪廓確實比之前少很多&#xff…

operator.ne_Python operator.ne()函數與示例

operator.neoperator.ne()函數 (operator.ne() Function) operator.ne() function is a library function of operator module, it is used to perform "not equal to operation" on two values and returns True if the first value is not equal to the second val…

國產操作系統和linux 之間的關系,為何國產系統大多基于開源Linux?操作系統從0做起到底有多難?...

今年貌似是國產操作系統的“爆發”之年&#xff0c;除了老牌的銀河麒麟、中標麒麟、深度之外&#xff0c;中興近日發布了自己的“新支點”&#xff0c;華為也公開了自研的操作系統“鴻蒙”。縱觀這些國產操作系統&#xff0c;大多基于開源的Linux。那么為什么我們不可以從0開始…

away3d創建基礎view世界(基礎 一)

對于away3d可能很多人有畏懼心里&#xff0c;其實away3d沒有想象中的那么難&#xff0c;現在我就教大家創建一個簡單的view世界。 package{import away3d.containers.View3D;import flash.display.Sprite;public class Main extends Sprite{private var view:View3D;//興建一個…

operator.eq_Python operator.eq()函數與示例

operator.eqoperator.eq()函數 (operator.eq() Function) operator.eq() function is a library function of operator module, it is used to perform "equal to operation" on two values and returns True if the first value is equal to the second value, Fals…

智能車復工日記【7】:關于會車的圖像問題

目錄 系列文章更換掃線方式獲取車的輪廓車屁股所在行數確定白色球臺導致的問題5.21思考1、 關于會車地點確定如何判斷會車狀態博主聯系方式: QQ:1540984562 QQ交流群:892023501 群里會有往屆的smarters和電賽選手,群里也會不時分享一些有用的資料,有問題可以在群里多問問。…