I'm writing a program using cos, sin and arctan. However, Whenever the program computes something it fails at doing cos and sin properly. I have not written it to the arctan stage yet.
Here is what I'm using:
angle is inputed by the user. This value is between 0 and 90.
value is also inputed by the user. This value is any positive value
When I unput a value of 90 and a angle of 0, I get the correct answer. However, if I input the value of 90 and have an angle of 45 I get: 47 for x and 76 for y.Code:forcex = value * cos(angle); forcey = value * sin(angle);
I'm using the following .h files:
math.h
stdio.h
stdlib.h
What exactly am I doing wrong here? Do I need to convert the degrees to radians or is there anyway I can keep it in degrees?