0

what is the problem?

#include <iostream> using namespace std; int main() { float x; int y; cin >> x; y=x; cout <<y<<endl; x=x-y; for(; ;){ x=x*10; y=x; if(y==x) break; } cout << x; return 0; }

21st Aug 2018, 7:26 AM
masoud sina
masoud sina - avatar
1 Réponse
+ 1
Here, I modified your code a bit, hope this helps. #include <iostream> int main() { float x; int y; std::cin >> x; std::cout << "float: " << x; y = static_cast<int>(x); x -= y; std::cout << "\nfloat: " << x << "\nint: " << y; return 0; }
21st Aug 2018, 8:39 AM
Ipang