# Trigonometric functions in C++

C++ Trigonometric functions: Here, we are going to learn about the various trigonometric functions like cos(), sin(), tan(), acos(), asin(), atan() and atan2() with example.
Submitted by IncludeHelp, on April 28, 2019

## C++ Trigonometric functions

Trigonometric functions are also called circular functions or angle functions or goniometric functions, which are used to trigonometric computations like computing cosine, sine, tangent values.

### List of trigonometric functions

Here is the list of all trigonometric functions with descriptions and their syntaxes,

Trigonometric functions Description Syntax
cos() It returns the cosine of an angle of x radians. cos(x)
sin() It returns the sine of an angle of x radians. sin(x)
tan() It returns the tangent of an angle of x radians. tan(x)
acos() It returns the arc cosine of x in radians. acos(x)
asin() It returns the arc sine of x in radians. asin(x)
atan() It returns the arc tangent of x in radians. atan(x)
atan2() It returns the arc tangent of y/x in radians. atan2(y,x)

### C++ code to demonstrate example of trigonometric functions

```// C++ code to demonstrate the example of
// trigonometric functions

#include <iostream>
#include <cmath>
using namespace std;

// main() section
int main()
{
float x;
float y;

x = 0.25;
cout<<"cos("<<x<<") : "<<cos (x)<<endl;
cout<<"sin("<<x<<") : "<<sin (x)<<endl;
cout<<"tan("<<x<<") : "<<tan (x)<<endl;
cout<<"acos("<<x<<"): "<<acos(x)<<endl;
cout<<"asin("<<x<<"): "<<asin(x)<<endl;
cout<<"atan("<<x<<"): "<<atan(x)<<endl;
y = 1.0;
cout<<"atan2("<<y<<","<<x<<"): "<<atan2(y,x)<<endl;

return 0;
}
```

Output

```cos(0.25) : 0.968912
sin(0.25) : 0.247404
tan(0.25) : 0.255342
acos(0.25): 1.31812
asin(0.25): 0.25268
atan(0.25): 0.244979
atan2(1,0.25): 1.32582
```

Top MCQs

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates