Solved

trigonometric functions

Posted on 2000-03-17
4
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

729 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