函数名:modf
功 能: 把数分为整数和小数
举例说明:
#include <math.h>
#include <stdio.h>
int main(void)
{
double fraction, integer;
double number = 100000.567;
fraction = modf(number, &integer);
printf("The whole and fractional parts of %lf are %lf and %lf\n",
number, integer, fraction);
return 0;
}
结果是:
The whole and fractional parts of 100000.567000 are 100000.000000 and 0.567000
怎么样,明白了吧