Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 equivalent to cosd
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: 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
Sponsor
sponsor
Mazer




PostPosted: 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




PostPosted: 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 Laughing
AsianSensation




PostPosted: 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




PostPosted: 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




PostPosted: 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 Laughing
thx ppl problem solved...
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: