#include <iostream> /* including standard library */ #include <cmath> /* including math library */ using namespace std; int main ( void ) { double y,x; x = 9; y = 4.2; //cout.setf(ios::fixed, ios::floatfield); cout.precision(8); cout << "rest of " << x << " / " << y << " is " << fmod(x,y) << endl; return 0; }
rest of 9 / 4.2 is 0.6