you get to enter a real number ( 12.345 ) you need to convert its fractional part 0.345 to the integer 345 and display it on the screen. What is the error in the loop?
#include <iostream> #include <cmath> using namespace std; main() { double r; cin>>r; double p=1; double i_r,i_r2; double ost_r=modf(r,&i_r); cout<<modf(ost_r,&i_r2); while(modf(ost_r,&i_r2)!=0) { ost_r*=10; cout<<ost_r<<endl; } }
eps(modulo). - Zealint