I expect the output in degrees
No you don’t. You expect your input to be interpreted as degrees.
sin
and cos
don’t return angles, so you can’t speak about their return values as of degrees or radians.
Not only you need to apply the radians<->degrees conversion to the angle before applying sin
or cos
to it, you also need to convert degrees to radians, not the other way around. Thus you need *PI/180
, not *180/PI
.
solved How do I calculate sin values in degree in c++? [closed]