Solved

trigonometric functions

Posted on 2000-03-17
4
208 Views
Last Modified: 2010-04-02
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
Comment
Question by:Marsc
4 Comments
 
LVL 1

Accepted Solution

by:
wildy earned 50 total points
ID: 2627209
they are in runtime lib: just include math.h and you get cos, sin, tan, ...
0
 
LVL 33

Expert Comment

by:hongjun
ID: 2630405
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
 
LVL 2

Expert Comment

by:VEngineer
ID: 2637918
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
 
LVL 1

Author Comment

by:Marsc
ID: 2698093
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Quicksort a dynamic deque 33 79
FMX enumerated colours 2 131
Where are the c++ header files to use in Eclipse? 4 46
Need some help with mailto 16 31
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question