Author 
Message 
Homer_simpson

Posted: Mon Jun 23, 2003 6:19 pm Post subject: equivalent to cosd 


what's the equivalent for the turing command "cosd" in c++? 





Sponsor Sponsor



Mazer

Posted: Mon Jun 23, 2003 6:40 pm Post subject: (No subject) 


i can't seem to find one... not that i've looked that thoroughly, i'm still pretty n00bish at C++. but it seems to me that a good site would be www.cprogramming.com
they have a (rather incomplete) listing of C++ functions. there were a few trig ones but they aren't the same as the sind and cosd of turing. 





Mazer

Posted: Mon Jun 23, 2003 6:44 pm Post subject: (No subject) 


wait... it turns out you can use plain old 'cos' or 'sin'. just one catch: the parameter is in radians. i think the ratio for converting degrees to radians is (Pi*degrees)/180
but then again, i suck at math 





AsianSensation

Posted: Mon Jun 23, 2003 6:46 pm Post subject: (No subject) 


I don't think there is one in C, I think you have to make it urself, just convert radians to degrees or something, I think martin made something like this. 





Mazer

Posted: Mon Jun 23, 2003 6:53 pm Post subject: (No subject) 


code: 
double deg2rad (double degrees)
{
double radians = (3.141592653*degrees)/180;
return
}

like that i guess. then it'd be:
code: 
cout << cos (deg2rad(45));

EDIT: of course, don't forget to include math.h if you haven't already. 





Homer_simpson

Posted: Mon Jun 23, 2003 8:05 pm Post subject: (No subject) 


Doh!!!!! I am an idiot... =S
y didn't i think of that....i just studied that last semester
thx ppl problem solved... 





