how to calculate trigonometric values in c 2b 2b

Solutions on MaxInterview for how to calculate trigonometric values in c 2b 2b by the best coders in the world

showing results for - "how to calculate trigonometric values in c 2b 2b"
Tommaso
22 Mar 2019
1*
2 * C++ Program to Illustrate Trigonometric functions
3 */
4#include <iostream>
5#include <iomanip>
6#include <cmath>
7const double PI = 3.14159265;
8 
9int main()
10{
11    double degrees, radians;
12 
13    std::cout << "Enter angle in degrees ";
14    std::cin >> degrees;
15    // Trigonometric functions accept angles in radians
16    radians = degrees * PI / 180.0;
17    std::cout << "Value of trigonometric ratios " << std::endl;
18    std::cout << "cos(radians) = " << std::setprecision(3)
19              << cos(radians) << std::endl;
20    std::cout << "sin(radians) = " << std::setprecision(3)
21              << sin(radians) << std::endl;
22    std::cout << "tan(radians) = " << std::setprecision(3)
23              << tan(radians) << std::endl;
24    return 0;
25}