|
|
||||
|
|
modf()Prototype: double modf(double number, double *intpart);Header File: math.h (C) or cmath (C++) Explanation: This function will return the decimal part of number, and it will place the integer part of number into the variable pointed to by intpart. Example:
//Example will output decimal and integer parts of 12.34
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
double x;
modf(12.34, &x);
cout<<"Decimal: "<<modf(12.34, &x)<<"Fractional: "<<x;
}
Other Functions
----- |
|
||