worng output in float divid
hi all
1 2 3 4
|
float x,y,z;
cin>>x>>y;
z=x*y;
z=z/100;
|
ok when i give x 5000000 ( if x is more than 4999988 out put will like this numbers 1e+06).
and y = 20 ( y must be under 100).
will give me this answer 1e+06
why? :(
i want to be normal numbers(not rounded i mean numbers do not need to be round).
thank you
Because 1000000 is equal to 1e+06;
Use
std::fixed to avoid scientific notation:
1 2 3
|
#include<iomanip>
//...
std::cout << std::fixed << z;
|
Topic archived. No new replies allowed.