日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c语言 函数的参数传递示例_restder()函数,带有C ++中的示例

發布時間:2023/12/1 编程问答 51 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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語言 函數的參數傳遞示例

總結

以上是生活随笔為你收集整理的c语言 函数的参数传递示例_restder()函数,带有C ++中的示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。