Calling a math function from math.h - C++ Function

C++ examples for Function:Math Function

Description

Calling a math function from math.h

Demo Code

#include <iostream> 
#include <math.h> 

using namespace std; 

int main() //from   w w  w.j a va2 s.  c o  m
{ 
  cout << fabs(-10.5) << endl; 
  cout << fabs(10.5) << endl; 

  double mynumber;
  mynumber = fabs(-23.87);

  cout << mynumber << endl;
  return 0;
}

Result


Related Tutorials