Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

modf() c++

#include <iostream>
#include <cmath> 
#include <iomanip> 
using namespace std;
#define prec cout<<fixed<<setprecision(8);
int main ()
{
  double param, fractpart, intpart;
  prec
  param = 3.14159265;
  fractpart = modf (param , &intpart); // Break into fractional and integral parts (function )
  cout<< param<<" = ("<<intpart<<" + "<<fractpart<<")"; // 3.14159265 = (3.00000000 + 0.14159265)
}
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
5+2 =