# C++ Program to Find the Inverse of a Trigonometric Ratio

This C++ program computes inverse of a trigonometric ratio. The program enters a choice as to inverse of which trigonometric ratio the user wants to compute the value. The user enters the trigonometric ratio of the chosen type and the inverse of trigonometric ratio is computed and printed.

Here is the source code of the C++ program computes inverse of a trigonometric ratio. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.

1. `/*`
2. ` * C++ Program to Obtain Inverse of a Trigonometric Ratio`
3. ` */`
4. `#include <iostream>`
5. `#include <cmath>`
6. `#include <iomanip>`
7. ` `
8. `int main()`
9. `{`
10. `    double value, result;`
11. `    int choice;`
12. ` `
13. `    std::cout << "Enter a choice " << std::endl;`
14. `    std::cout << "1. Inverse Sine" << std::endl;`
15. `    std::cout << "2. Inverse Cosine" << std::endl;`
16. `    std::cout << "3. Inverse Tangent" << std::endl;`
17. `    std::cin  >> choice;`
18. `    switch (choice) {`
19. `        case 1:`
20. `            std::cout << "Enter a value ";`
21. `            std::cin  >> value;`
22. `            std::cout << "asin(val) = " << std::setprecision(3)`
23. `                      << asin(value) << std::endl;`
24. `            break;`
25. `        case 2:`
26. `            std::cout << "Enter a value ";`
27. `            std::cin  >> value;`
28. `            std::cout << "acos(val) = " << std::setprecision(3)`
29. `                      << acos(value) << std::endl;`
30. `            break;`
31. `        case 3:`
32. `            std::cout << "Enter a value ";`
33. `            std::cin  >> value;`
34. `            std::cout << "atan(val) = " << std::setprecision(3)`
35. `                      << atan(value)  << std::endl;`
36. `            break;`
37. `    }`
38. `    return 0;`
39. `}`

```\$ a.out
Enter a choice
1. Inverse Sine
2. Inverse Cosine
3. Inverse Tangent
1
Enter a value 1
asin(val) = 1.57```

Sanfoundry Global Education & Learning Series – 1000 C++ Programs.