Question Answer Forum

Answers


Shaibal Rauniyar
NAIL MAKING MACHINE SETTER

ANSWER # 1 #

1
*
2
 * C++ Program to Illustrate Trigonometric functions
3
 */
4
#include <iostream>
5
#include <iomanip>
6
#include <cmath>
7
const double PI = 3.14159265;
8
 
9
int 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
}

Is it a good answer? [2]

Want to query,suggest or complain to the author!
Want to post an answer?