conversion from double to unsigned int

前端 未结 3 543
无人共我
无人共我 2021-01-17 18:02

I am facing a problem with the conversion of value from Double to int. I try to run the following code :

int main()
{
    double val_d= 6.25e-05;
    cout &l         


        
3条回答
  •  天涯浪人
    2021-01-17 18:46

    Converting a floating-point value to an integral value removes the fractional part, provided the result can be represented in the integral type (i.e. the value isn't too large to fit). Inserting into a stream rounds the value, which can produce a different result.

提交回复
热议问题