Getting different output from seemingly identical calculations

前端 未结 4 376
抹茶落季
抹茶落季 2021-01-21 03:15

Can anyone tell me why the calculations on lines 9 and 11, which seem to be identical, produce two different outputs. I know the difference isn\'t that great, but I am using the

4条回答
  •  半阙折子戏
    2021-01-21 03:54

    This is outputting a floating point number

     std::cout <<  400+(sin((90*3.14159)/180)*10) << std::endl;
    

    But this is outputting an integer, so will have been truncated

    std::cout << ypos << std::endl;
    

提交回复
热议问题