How can I perform modulo on a decimal calculations?
ie,
3.01 % 3.00
How can I perform modulo on a decimal calculations?
ie,
3.01 % 3.00
Maybe this is what you want:
Although I wouldn't say that is modulo...Code:#include <iostream> #include <cmath> using namespace std; int main ( ) { double x, y, z; int t; x = 3.5; y = 2.6; z = x / y; t = floor ( z ); cout<< "mod is: "<< z-t; return 0; }
- Micko
Gotta love the "please fix this for me, but I'm not going to tell you which functions we're allowed to use" posts.
It's like teaching people to walk by first breaking their legs - muppet teachers! - Salem
modf(), in math.h
Thanks