Simple Math: How can I use Sin(); cos()
Hi there,
I need sin() and cos(). In VB its just sin(1.5) but C++ don''t know sin()...
Who can help?
DarkMcNugget next time... ;)
#include <math.h>
sin(whatever);
cos(whatever);
tan(whatever);
asin(whatever);
acos(whatever);
atan(whatever);
sinh(whatever);
cosh(whatever);
tanh(whatever);
log(whatever);
exp(whatever);
pow(whatever to, power);
sin(whatever);
cos(whatever);
tan(whatever);
asin(whatever);
acos(whatever);
atan(whatever);
sinh(whatever);
cosh(whatever);
tanh(whatever);
log(whatever);
exp(whatever);
pow(whatever to, power);
Yes, did exactly that.
math.h is included in a include-file I included in the mainloop-file. So it should be working....
I will check everthing again..
thankx anyway
math.h is included in a include-file I included in the mainloop-file. So it should be working....
I will check everthing again..

thankx anyway
DarkMcNugget next time... ;)
what's the problem? you didn't say. not working is not good enough. does it give you an error when you compile? or when you run? or does it work, but the results are not what you expected?
one side note, all c++ sin/cos/tan functions operate in radians. radians are similar to degrees, but have different values:
0 degrees = 0 radians
90 degrees = pi / 2 radians
180 degrees = pi radians
360 degrees (same as 0 degrees) = 2 * pi radians (same as 0 radians)
so if you want to convert them, use this formula:
degrees = (180 / pi) * radians
radians = (pi / 180) * degrees
i'm doing this off top of my head, so please correct me if i made any mistakes.
---
shurcool
my project
[edited by - shurcool on June 25, 2002 9:20:06 AM]
one side note, all c++ sin/cos/tan functions operate in radians. radians are similar to degrees, but have different values:
0 degrees = 0 radians
90 degrees = pi / 2 radians
180 degrees = pi radians
360 degrees (same as 0 degrees) = 2 * pi radians (same as 0 radians)
so if you want to convert them, use this formula:
degrees = (180 / pi) * radians
radians = (pi / 180) * degrees
i'm doing this off top of my head, so please correct me if i made any mistakes.
---
shurcool
my project
[edited by - shurcool on June 25, 2002 9:20:06 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement