返回值:
导读:函数返回值定义的结构在,其中有两个成员。为 div_t:int quot; int rem; 如何使用div( 函数: #include #include int main( { div_t output; output...
函数返回值定义的结构在,其中有两个成员。为 div_t:int quot; int rem;
如何使用div() 函数:
#include
#include
int main() {
div_t output;
output = div(27, 4);
printf("Quotient part of (29/ 4) = %d \n", output.quot);
printf("Remainder part of (29/4) = %d \n", output.rem);
output = div(27, 3);
printf("Quotient part of (30/ 3) = %d \n", output.quot);
printf("Remainder part of (30/3) = %d \n", output.rem);
return(0);
}
编译和运行上面的程序,产生如下结果:
Quotient part of (29/ 4) = 7
Remainder part of (29/4) = 1
Quotient part of (30/ 3) = 10
Remainder part of (30/3) = 0
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: 返回值:
本文地址: https://pptw.com/jishu/667768.html
