• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

trigonometric functions

Hello experts...

I need some help...
I need to do some trigonometric operations in my program...
I need to know how to do that...
I mean... Are there functions in C++ as to be Sin, Cos?...

Are they in runtime libraries?.... is there some win api to do that?.

Well... I need all posible help about this...

Thank you very much.
0
Marsc
Asked:
Marsc
1 Solution
 
wildyCommented:
they are in runtime lib: just include math.h and you get cos, sin, tan, ...
0
 
hongjunCommented:
Just #include <math.h> and you will be able to use all pre-defined functions.

Open up math.h and you will find all the syntax of using them. You can also refer to any C or C++ text on how to use them.

hongjun
0
 
VEngineerCommented:
actually, according to the new C++ standard, you should be including:
#include <cmath>
instead of #include <math.h>.  Either one will work now, but the first way is preferable.

once you include that file, you will have access to the following functions:

double sin(double x);
double cos(double x);
double tan(double x);
double asin(double x);
double acos(double x);
double atan(double x);
double pow(double base, double exponent);
double log(double x);

and there are more - you will need to look at the documentation

so usage is easy:  double result = sin(value);

let me know if you need anything else.
0
 
MarscAuthor Commented:
Well...

I forgot to grade this answer before... I'm sorry about that.

VEngineer: I'm sorry for not accepting your answer, but I only can accept one, and wildy was first, and I applied what he told to me and worked just fine.
But I thank to you.
I will keep in mind what you say in my next program :-)

wildy... Thanks

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now