Solved

trigonometric functions

Posted on 2000-03-17
4
206 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

930 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now