前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >c语言 函数的参数传递示例_remquo()函数与C ++中的示例

c语言 函数的参数传递示例_remquo()函数与C ++中的示例

作者头像
用户7886150
修改2021-02-11 18:18:24
1.5K0
修改2021-02-11 18:18:24
举报
文章被收录于专栏:bit哲学院bit哲学院

参考链接: C++ restder()

c语言 函数的参数传递示例

  C ++ remquo()函数 (C++ remquo() function) 

 remquo() function is a library function of cmath header. It is used to calculate the remainder and quotient, this function is the same as the remainder() function, but this function also stores the quotient that can be used further. It accepts three parameters (numerator, denominator, and quotient) and returns the remainder, assigns the quotient in the third parameter which should be a pointer. 

  remquo()函数是cmath标头的库函数。 它用于计算余数和商,此函数与restder()函数相同 ,但是此函数还存储可以进一步使用的商。 它接受三个参数( numerator , denominator和quotient )并返回余数,在第三个参数中分配商,它应该是一个指针。  

 Syntax of remquo() function: 

  remquo()函数的语法:  

 C++11: 

  C ++ 11:  

      double remquo (double numer     , double denom     , int* quot);

      float remquo (float numer      , float denom      , int* quot);

long double remquo (long double numer, long double denom, int* quot);

     double remquo (Type1 numer      , Type2 denom      , int* quot);

 Parameter(s): 

  参数:  

 numer, denom – represent the values of numerator and denominator. numer,denom –表示分子和分母的值。 *quot– represents an integer pointer to store the quotient. * quot –表示存储商的整数指针。 

 Return value: 

  返回值:  

 It returns the remquo. 

  它返回remquo。  

 Note: 

  注意:  

 If the remquo is 0, then its sign is the same as the sign of numer. 如果remquo为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 = 10.34;

    double y = 2.5;

    double rem;

    int quo;

    Function call:

    remquo(x, y, &quo);

    Output:

    rem = 0.34

    quo = 4

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

 // C++ code to demonstrate the example of

// remquo() function

#include <iostream>

#include <cmath>

using namespace std;

// main() section

int main()

{

    double x;

    double y;

    double r;

    int q;

    x = 10;

    y = 2;

    r = remquo(x, y, &q);

    cout << "numerator  : " << x << endl;

    cout << "denominator: " << y << endl;

    cout << "remainder  : " << r << endl;

    cout << "quotient   : " << q << endl;

    cout << endl;

    x = 10.34;

    y = 2.5;

    r = remquo(x, y, &q);

    cout << "numerator  : " << x << endl;

    cout << "denominator: " << y << endl;

    cout << "remainder  : " << r << endl;

    cout << "quotient   : " << q << endl;

    cout << endl;

    x = -10.02;

    y = 2.3;

    r = remquo(x, y, &q);

    cout << "numerator  : " << x << endl;

    cout << "denominator: " << y << endl;

    cout << "remainder  : " << r << endl;

    cout << "quotient   : " << q << endl;

    cout << endl;

    x = 10.23;

    y = -2.0;

    r = remquo(x, y, &q);

    cout << "numerator  : " << x << endl;

    cout << "denominator: " << y << endl;

    cout << "remainder  : " << r << endl;

    cout << "quotient   : " << q << endl;

    cout << endl;

    return 0;

}

 Output 

  输出量  

 numerator  : 10

denominator: 2

remainder  : 0

quotient   : 5

numerator  : 10.34

denominator: 2.5

remainder  : 0.34

quotient   : 4

numerator  : -10.02

denominator: 2.3

remainder  : -0.82

quotient   : -4

numerator  : 10.23

denominator: -2

remainder  : 0.23

quotient   : -5

 Reference: C++ remquo() function 

  参考: C ++ remquo()函数  

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

 c语言 函数的参数传递示例

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档