欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

函数返回值定义的结构在<cstdlib>,其中有两个成员。为 div_t:int quot; int rem;

如何使用div() 函数:

#include <stdio.h>

#include <stdlib.h>

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

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css-jiaocheng/tc58584.shtml