Programming Reference/Librarys
Question & Answer
Q&A is closed
#include <iostream> /* including standard library */ #include <cmath> /* including math library */ using namespace std; int main ( void ) { double y,x; x = 4.2422; y = -3284.2; //cout.setf(ios::fixed, ios::floatfield); cout.precision(8); cout << "the fabs of 4.2422 is " << fabs(x) << endl; cout << "and the fabs of -3284.2 is " << fabs(y) << endl; return 0; }
the fabs of 4.2422 is 4.2422 and the fabs of -3284.2 is 3284.2