double d = 10000000000000000; It is necessary that this number be displayed on the screen in this form without a floating point.
|
1 answer
C ++ style:
std::cout.setf(std::ios::fixed); std::cout.precision(0); //0 - число символов после точки std::cout << d;
C style:
printf("%.0lf",d); //%.Klf - K - число символов после точки, в данном случае 0
- +1, but note that the number 1000000000000000001 will be displayed exactly the same way : ideone.com/1SEHpO (because ideone.com/qJOA2I ) - VladD
- @VlaD, you can explain in detail here hashcode.ru/questions/191857 - BogolyubskiyAlexey
|