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 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有