Like if I I put
I get that a = .525322 when a should be = 7.07106. This happens with all thease kinds of funtions, whats happening?Code:double a = cos(45);
Like if I I put
I get that a = .525322 when a should be = 7.07106. This happens with all thease kinds of funtions, whats happening?Code:double a = cos(45);
a = .525322 because the function cos takes in radians rather than degrees (which should be .707106, not 7.07106)
Those functions take radians not degrees.
duh! of course haha, Thanks a lot for the help guys :)
oh and... so... like if I want to put cos(45°) (the degrees that you need 360 for a circle) how would I do it? :confused:
You could write wrapper functions that do the conversions so that when you call them, you can always do it in degrees.
As Joshdick mentioned, write a wrapper function that converts the degree measure into radians (degree * PI/180)
e.g.
Code:double sin_d (double degrees)
{
return (sin(degrees * 3.1416/180));
}